Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

VIEW::Scene Class Reference
[Modular Widgets]

Scene is the main visualization widget that shows the graphical Representation 's. More...

#include <scene.h>

Inheritance diagram for VIEW::Scene:

VIEW::ModularWidget Embeddable VIEW::ConnectionObject VIEW::EditableScene List of all members.

Debugging and Diagnostics

virtual bool isValid () const throw ()
 Internal state and consistency self-validation.
virtual void dump (std::ostream &s=std::cout, Size depth=0) const throw ()
 Internal value dump.
StagegetStage () throw ()
const StagegetStage () const throw ()
void setCamera (const Camera &camera) throw ()
List< Camera > & getAnimationPoints () throw ()
void setDefaultLighting (bool update_GL=true) throw ()
void initializePreferencesTab (Preferences &preferences) throw ()
 Initialize a preferences tab for the widget (if needed).
void finalizePreferencesTab (Preferences &preferences) throw ()
 Remove the preferences tab.
virtual void applyPreferences () throw ()
 Apply the preferences of the specific tab.
GLRenderergetGLRenderer () throw ()
void setGLRenderer (GLRenderer &renderer)
 Set a new GLRenderer.
float getMousePositionX ()
float getMousePositionY ()
bool exportPNG (const String &filename)
virtual void setWidgetVisible (bool state)
void setOffScreenRendering (bool enabled, Size factor)
virtual void keyPressEvent (QKeyEvent *e)
 Catch key events.
virtual void mouseDoubleClickEvent (QMouseEvent *e)
ModeType getMode () const throw ()
virtual void setMode (ModeType mode) throw ()
void rotate (float degree_right, float degree_up)
void rotateClockwise (float degree)
void move (Vector3 v)
 Move the view.
void moveComposites (const List< Composite * > &composites, Vector3 v)
 Move some Composites.
void rotateComposites (const List< Composite * > &composites, float degree_right, float degree_up, float degree_clockwise=0)
 Rotate some Composites.
bool isAnimationRunning () const throw ()
void setTurnPoint (const Vector3 &v)
const Vector3getTurnPoint () const
void setFullScreen (bool state)
void setFPSEnabled (bool state)
void showText (const String &text, Size font_size=20)
 Show text in the lower right corner.
virtual void addToolBarEntries (QToolBar *tb)
 Add the widgets actions to the (main) toolbar.
bool isUpdateRunning () const
void createCoordinateSystem () throw ()
 Create an coordinate system at current position.
void createCoordinateSystemAtOrigin () throw ()
 Create an coordinate system at origin.
String exportPNG ()
 Export PNG image and return the filename.
void exportPOVRay ()
void exportNextPOVRay ()
 Export to POVRay whithout showing file dialog.
void printScene ()
void showExportPNGDialog ()
 show an dialog to save an PNG file to
void showExportVRMLDialog ()
void setPreview (bool state)
 Enable or disable model previews e.g. while rotating.
virtual void switchShowWidget () throw ()
 Show or hide widget (Called by menu entry in "WINDOWS") If the ModularWidget is not also a QWidget, this method does nothing.
void exitStereo () throw ()
void enterActiveStereo () throw ()
void enterDualStereo () throw ()
void clearRecordedAnimation () throw ()
void startAnimation () throw ()
void stopAnimation () throw ()
void switchToLastMode () throw ()
void switchShowGrid ()
void showInfos ()
 Popup informations for object under mouse cursor.
void setupViewVolume ()
void disableViewVolumeRestriction ()
void storeViewPoint ()
void restoreViewPoint ()
void setAnimationSmoothness (float value) throw ()
float getAnimationSmoothness () throw ()
void setMouseSensitivity (float sensitivity) throw ()
float getMouseSensitivity () throw ()
void setMouseWheelSensitivity (float sensitivity) throw ()
float getMouseWheelSensitivity () throw ()
void setShowLightSources (bool state) throw ()
bool showLightSourcesEnabled () throw ()
bool stereoBufferSupportTest ()
void setScreenShotNumber (Position pos)
void setPOVNumber (Position pos)

Protected QT overridden virtual methods

virtual void initializeGL ()
 Initialize the OpenGL context.
virtual void paintGL ()
 Render the visualization.
virtual void resizeGL (int width, int height)
 Resize the widget.
virtual void mouseMoveEvent (QMouseEvent *qmouse_event)
 Catch mouse move events, store the actual mouse position in this scene widget and sent events accordingly.
virtual void mousePressEvent (QMouseEvent *qmouse_event)
 Catch mouse press events, store the actual mouse position in this scene widget and sent events accordingly.
virtual void mouseReleaseEvent (QMouseEvent *qmouse_event)
 Catch mouse release events, store the actual mouse position in this scene widget and sent events accordingly.
virtual void wheelEvent (QWheelEvent *qmouse_event)
 Catch mouse wheel events and zoom the scene accordingly.
void updateGL ()
void renderView_ (RenderMode mode) throw ()
void renderRepresentations_ (RenderMode mode) throw ()
void render_ (const Representation &rep, RenderMode mode) throw ()
void animate_ () throw ()
void processRotateModeMouseEvents_ (QMouseEvent *e)
void processMoveModeMouseEvents_ (QMouseEvent *e)
void rotateSystem_ ()
void rotateSystemClockwise_ ()
void translateSystem_ ()
void zoomSystem_ ()
Index getMoveModeAction_ (const QMouseEvent &e)
void selectionPressed_ ()
void selectionPressedMoved_ ()
void selectObjects_ ()
void pickParent_ (QPoint p)
void writeLights_ (INIFile &inifile) const throw ()
void readLights_ (const INIFile &inifile) throw ()
float getXDiff_ ()
float getYDiff_ ()
Vector3 getTranslationVector_ (const Vector3 &v)
void createCoordinateSystem_ (bool at_origin) throw ()
void renderGrid_ ()
Vector3 get3DPosition_ (int x, int y)
 Given 2D screen coordinates computes the 3D Position in Viewing Volume.
bool mapViewplaneToScreen_ ()
 Maps the current viewplane to screen coordinates.
ModeType current_mode_
ModeType last_mode_
QAction * rotate_action_
QAction * picking_action_
QAction * move_action_
QAction * no_stereo_action_
QAction * active_stereo_action_
QAction * dual_stereo_action_
QAction * fullscreen_action_
QAction * record_animation_action_
QAction * start_animation_action_
QAction * clear_animation_action_
QAction * cancel_animation_action_
QAction * animation_export_POV_action_
QAction * animation_export_PNG_action_
QAction * animation_repeat_action_
QAction * switch_grid_
QMenu * create_coordinate_system_
Vector3 system_origin_
bool need_update_
bool update_running_
Index x_window_pos_old_
Index y_window_pos_old_
Index x_window_pos_new_
Index y_window_pos_new_
Index x_window_pick_pos_first_
Index y_window_pick_pos_first_
Index x_window_pick_pos_second_
Index y_window_pick_pos_second_
bool pick_select_
QRubberBand * rb_
Stagestage_
Camera stereo_camera_
Camera stored_camera_
GLRenderergl_renderer_
LightSettingslight_settings_
StageSettingsstage_settings_
MaterialSettingsmaterial_settings_
List< Cameraanimation_points_
AnimationThread * animation_thread_
bool stop_animation_
bool content_changed_
bool want_to_use_vertex_buffer_
bool mouse_button_is_pressed_
bool preview_
bool use_preview_
PreciseTime time_
float zoom_factor_
QPoint info_point_
QByteArray last_state_
list< float > fps_
bool show_fps_
String text_
Size font_size_
QToolBar * toolbar_
QList< QAction * > toolbar_actions_
bool draw_grid_
bool ignore_pick_
QActionGroup * mode_group_
Vector3 near_left_bot_
Vector3 near_right_bot_
Vector3 near_left_top_
String info_string_
float volume_width_
float mouse_sensitivity_
float mouse_wheel_sensitivity_
bool show_light_sources_
float animation_smoothness_
Position screenshot_nr_
Position pov_nr_
QGLFormat gl_format_
bool offscreen_rendering_
QSize PNG_size_

Public Types

Type definitions
enum  ModeType { ROTATE__MODE = 0, MOVE__MODE, PICKING__MODE }
 Predefined constants for the mode types Add new enums members in derived classes, for new modi. More...
enum  ModeAction { TRANSLATE_ACTION, ZOOM_ACTION, ROTATE_ACTION, ROTATE_CLOCKWISE_ACTION }
 Different Mouse Mode actions.
Enums
enum  RenderMode { DIRECT_RENDERING = 0, DISPLAY_LISTS_RENDERING, REBUILD_DISPLAY_LISTS }
 There a three different kind of rendering for a Scene:. More...

Public Member Functions

Constructors and Destructor
 Scene (QWidget *parent_widget, const char *name=NULL, Qt::WFlags w_flags=0) throw ()
 Default Constructor.
 Scene (const Scene &scene, QWidget *parent_widget=NULL, const char *name=NULL, Qt::WFlags wflags=0) throw ()
 Copy constructor.
virtual ~Scene () throw ()
 Destructor.
virtual void clear () throw ()
 Explicit default initialization.
Assignment
void set (const Scene &scene) throw ()
 Assignment.
const Sceneoperator= (const Scene &scene) throw ()
 Assignment operator.
Accessors: inspectors and mutators
void update (bool rebuild_displaylists=false) throw ()
 Update the visualization.
virtual void onNotify (Message *message) throw ()
 Handles messages sent by other registered ConnectionObject objects.
virtual bool exportScene (Renderer &er) const throw ()
 This method exports the content of the Scene to an external Renderer.
virtual void initializeWidget (MainControl &main_control) throw ()
 Initialize the popup menu Display and the menus of this scene: - the rotate mode (all mouse actions are attached to rotating, translating and zooming the scene) - the picking mode (all mouse actions are attached to picking objects from the scene).
virtual void fetchPreferences (INIFile &inifile) throw ()
 Fetch the widgets preferences from the INIFile.
virtual void writePreferences (INIFile &inifile) throw ()
 Writes the widgets preferences to the INIFile.
virtual void checkMenu (MainControl &main_control) throw ()
 Menu checking method.

Protected Slots

Protected slots
virtual void rotateMode_ ()
 Switch to rotate mode.
virtual void pickingMode_ ()
 Switch to picking mode.
virtual void moveMode_ ()
virtual void showViewPoint_ () throw ()
 Show the viewpoint and the look at point in the statusline of the mainwidget.
virtual void setViewPoint_ () throw ()
 Set the viewpoint.
virtual void resetCamera_ () throw ()
 Reset the camera to standard values.
virtual void updateCamera_ () throw ()
 Update the GL camera and if necessary the lights.
virtual void dropEvent (QDropEvent *e)
virtual void dragEnterEvent (QDragEnterEvent *e)
void dummySlot ()

Friends

class AnimationThread

Detailed Description

Scene is the main visualization widget that shows the graphical Representation 's.

To do this, the class Scene must be a child of the MainControl. Because the MainControl is also the main application object a Scene must be created with the pointer to the MainControl as parent widget.
Scene is capable of stereo 3D view with shutter glasses and CRT monitors. This only works, if the OpenGL-driver supports this. NVIDIA cards need a Quad buffer, like they are used in the "Quad" cards. For other NVIDIA cards, you can try the tool "Rivatuner", which tries to enable this feature for cards, which natively dont support this. To enter and leave the stereo mode, press ALT-Y. If your OpenGL doesnt support the stereo view, you will see an error message in the message bar at the bottom of the main window.

The Scene has tree different mouse modi:

To change between the first two modi, there is a menu entry with checkboxes in the main menu bar of the application.
In Picking mode, left mouse button selects composites and right mouse button deselects. There are two ways to (de-)select: Either click on single items, or draw a selection rectangle by keeping the mouse button pressed and moving the mouse. Users with only one mouse button can use the SHIFT button, while pressing the mouse button to deselect.
In Rotate mode, left mouse button rotates, mid mouse button zooms in and out and right button moves the view. Users with only one mouse button can use the SHIFT / CONTROL button, while pressing the mouse button.
The eye distance change mode is only available in the stereo view mode. Here a user can press the ALT-button and move the mouse left or right to adjust the eye distance to their desired value.
Its possible to add new modi, to do so, derive a new class from Scene and overload the mouse*Event methods.

Furthermore, users can create modified versions of the GLRenderer and pass them to the Scene with the method setGLRenderer.


Member Enumeration Documentation

enum VIEW::Scene::ModeType
 

Predefined constants for the mode types Add new enums members in derived classes, for new modi.

If you add new modi in this class, you have to add them in front of the PICKING__MODE entry.

Enumeration values:
ROTATE__MODE  Default value.
MOVE__MODE  Move mode.
PICKING__MODE  Picking mode.

enum VIEW::Scene::RenderMode
 

There a three different kind of rendering for a Scene:.

Enumeration values:
DIRECT_RENDERING  Render without display lists, directly to the Scene.
DISPLAY_LISTS_RENDERING  Render the contents of the display lists.
REBUILD_DISPLAY_LISTS  Rebuild the contents of the display lists and redraw them.


Constructor & Destructor Documentation

VIEW::Scene::Scene QWidget *  parent_widget,
const char *  name = NULL,
Qt::WFlags  w_flags = 0
throw ()
 

Default Constructor.

Initialize the width and height of this scene to 600 and sets the camera position.

Calls registerWidget.
Parameters:
parent_widget the parent widget of this scene
name the name of this scene
w_flags the flags the scene widget should have (See documentation of QT-library for information concerning widget flags)

VIEW::Scene::Scene const Scene scene,
QWidget *  parent_widget = NULL,
const char *  name = NULL,
Qt::WFlags  wflags = 0
throw ()
 

Copy constructor.

Initialize the width, height and camera position.

Calls registerWidget.
Parameters:
scene the scene to be copied
parent_widget the parent widget of this scene
name the name of this scene
wflags the flags the scene widget should have (See documentation of QT-library for information concerning widget flags)

virtual VIEW::Scene::~Scene  )  throw () [virtual]
 

Destructor.


Member Function Documentation

virtual void VIEW::Scene::addToolBarEntries QToolBar *  tb  )  [virtual]
 

Add the widgets actions to the (main) toolbar.

This method is needed to enable ordering the entries. It is called in Mainframe.

Reimplemented from VIEW::ModularWidget.

Reimplemented in VIEW::EditableScene.

virtual void VIEW::Scene::applyPreferences  )  throw () [virtual]
 

Apply the preferences of the specific tab.

In this method the widget can extract any changed values from its preferences tab (if required). This method is called automatically by the applyPreferencesTab from the MainControl object if the apply button in the Preferences dialog is pressed.

Parameters:
preferences the Preferences dialog of the MainControl
See also:
initializePreferencesTab

finalizePreferencesTab

applyPreferencesTab

Reimplemented from VIEW::ModularWidget.

Reimplemented in VIEW::EditableScene.

virtual void VIEW::Scene::checkMenu MainControl main_control  )  throw () [virtual]
 

Menu checking method.

This method is called by MainControl::checkMenus before a popup menu is shown. The menus rotate mode and picking mode each will be checked if this scene is in the corresponding mode.

Parameters:
main_control the MainControl object whose menus should be checked
See also:
initializeWidget

finalizeWidget

checkMenus

show

Reimplemented from VIEW::ModularWidget.

Reimplemented in VIEW::EditableScene.

virtual void VIEW::Scene::clear  )  throw () [virtual]
 

Explicit default initialization.

Reset the default values of this scene to:

  • width is set to 600
  • height is set to 600
  • camera position set to Vector(1,0,0)
  • camera look at position set to Vector(0,0,0)

Reimplemented from VIEW::ModularWidget.

virtual void VIEW::Scene::dump std::ostream &  s = std::cout,
Size  depth = 0
const throw () [virtual]
 

Internal value dump.

Dump the current internal state of this scene to the output ostream s with dumping depth depth.

Parameters:
s output stream where to output the internal state of this scene
depth the dumping depth

Reimplemented from VIEW::ModularWidget.

virtual bool VIEW::Scene::exportScene Renderer er  )  const throw () [virtual]
 

This method exports the content of the Scene to an external Renderer.

virtual void VIEW::Scene::fetchPreferences INIFile inifile  )  throw () [virtual]
 

Fetch the widgets preferences from the INIFile.

This method is called automatically by MainControl::show() at the start of the application.

Parameters:
inifile the INIFile that contains the needed values
See also:
writePreferences

Reimplemented from VIEW::ModularWidget.

void VIEW::Scene::finalizePreferencesTab Preferences preferences  )  throw () [virtual]
 

Remove the preferences tab.

This method can remove a preferences widget (if created in initializePreferencesTab) from the Preferences dialog of the MainControl. This method is called automatically by MainControl::aboutToExit() at the end of the application.

Parameters:
preferences the Preferences dialog of the MainControl

Reimplemented from VIEW::ModularWidget.

Reimplemented in VIEW::EditableScene.

virtual void VIEW::Scene::initializeGL  )  [protected, virtual]
 

Initialize the OpenGL context.

Overriden qt method for initializing the OpenGL context of this scene. This method will be called automatically before any call to paintGL or resizeGL. It initializes the OpenGL-Renderer via GLRenderer::init and GLRenderer::setStage. See QT-library for information concerning the qglwidget events.

See also:
paintGL

resizeGL

GLRenderer::init

void VIEW::Scene::initializePreferencesTab Preferences preferences  )  throw () [virtual]
 

Initialize a preferences tab for the widget (if needed).

This method can be used to create preferences widgets that can be inserted into the Preferences dialog with the method insertTab. This method is called automatically by MainControl::show at the start of the application.

Parameters:
preferences the Preferences dialog of the MainControl

Reimplemented from VIEW::ModularWidget.

Reimplemented in VIEW::EditableScene.

virtual void VIEW::Scene::initializeWidget MainControl main_control  )  throw () [virtual]
 

Initialize the popup menu Display and the menus of this scene: - the rotate mode (all mouse actions are attached to rotating, translating and zooming the scene) - the picking mode (all mouse actions are attached to picking objects from the scene).

This method is called automatically immediately before the main application is started by MainControl::show().
Parameters:
main_control the MainControl object to be initialized with this scene

Reimplemented from VIEW::ModularWidget.

Reimplemented in VIEW::EditableScene.

virtual bool VIEW::Scene::isValid  )  const throw () [virtual]
 

Internal state and consistency self-validation.

A Scene is valid if it has a parent.

Reimplemented from VIEW::ConnectionObject.

bool VIEW::Scene::mapViewplaneToScreen_  )  [protected]
 

Maps the current viewplane to screen coordinates.

Returns false if the projection matrix is not correctly initialized.

virtual void VIEW::Scene::mouseMoveEvent QMouseEvent *  qmouse_event  )  [protected, virtual]
 

Catch mouse move events, store the actual mouse position in this scene widget and sent events accordingly.

Parameters:
e the QT-mouse event (See QT-library for mouse events)

Reimplemented in VIEW::EditableScene.

virtual void VIEW::Scene::mousePressEvent QMouseEvent *  qmouse_event  )  [protected, virtual]
 

Catch mouse press events, store the actual mouse position in this scene widget and sent events accordingly.

Parameters:
e the QT-mouse event (See QT-library for mouse events)

Reimplemented in VIEW::EditableScene.

virtual void VIEW::Scene::mouseReleaseEvent QMouseEvent *  qmouse_event  )  [protected, virtual]
 

Catch mouse release events, store the actual mouse position in this scene widget and sent events accordingly.

Parameters:
e the QT-mouse event (See QT-library for mouse events)

Reimplemented in VIEW::EditableScene.

void VIEW::Scene::move Vector3  v  ) 
 

Move the view.

\ v.x = right \ v.y = up \ v.z = view direction

void VIEW::Scene::moveComposites const List< Composite * > &  composites,
Vector3  v
 

Move some Composites.

\ v.x = right \ v.y = up \ v.z = view direction

virtual void VIEW::Scene::onNotify Message message  )  throw () [virtual]
 

Handles messages sent by other registered ConnectionObject objects.

Filters for SceneMessage and sets the Camera appropriate or updates the visualization.

Parameters:
message the pointer to the message that should be processed
See also:
ConnectionObject

Message

Reimplemented from VIEW::ConnectionObject.

Reimplemented in VIEW::EditableScene.

const Scene& VIEW::Scene::operator= const Scene scene  )  throw ()
 

Assignment operator.

Calls set.

virtual void VIEW::Scene::paintGL  )  [protected, virtual]
 

Render the visualization.

Overriden qt method for rendering the visualization of this scene. This method will be called automatically every time an update is necessary. See QT-library for information concerning qglwidgets and paintGL methods and events.

See also:
MainControl

Reimplemented in VIEW::EditableScene.

virtual void VIEW::Scene::pickingMode_  )  [protected, virtual, slot]
 

Switch to picking mode.

If this method is called the mouse actions of this scene will perform object picking. This method will be called from the corresponding menu entry.

See also:
initializeWidget

checkMenu

virtual void VIEW::Scene::resizeGL int  width,
int  height
[protected, virtual]
 

Resize the widget.

Overridden qt method for resizing this scene. This method will be called automatically every time a rezize event is handled. See QT-library for information concerning qglwidgets and resizeGL methods and events.

Parameters:
width the new width of this scene
height the new height of this scene

void VIEW::Scene::rotateComposites const List< Composite * > &  composites,
float  degree_right,
float  degree_up,
float  degree_clockwise = 0
 

Rotate some Composites.

\ v.x = right \ v.y = up \ v.z = view direction

virtual void VIEW::Scene::rotateMode_  )  [protected, virtual, slot]
 

Switch to rotate mode.

If this method is called the mouse actions of this scene will perform rotation, translation and zooming the visualization. This method will be called from the corresponding menu entry.

See also:
initializeWidget

checkMenu

void VIEW::Scene::set const Scene scene  )  throw ()
 

Assignment.

Initialize the width, height and camera position.

Parameters:
scene the scene to be copied

void VIEW::Scene::setGLRenderer GLRenderer renderer  ) 
 

Set a new GLRenderer.

This method is intended for users, that what to overload the behaviour of the GLRenderer.

void VIEW::Scene::showText const String text,
Size  font_size = 20
 

Show text in the lower right corner.

To clear the text, call this method again with an empty string.

void VIEW::Scene::update bool  rebuild_displaylists = false  )  throw ()
 

Update the visualization.

Parameters:
rebuild_displaylists is set to true than all GLDisplayList are updated. If set to false, the display is only redrawed.
See also:
GLDisplayList

virtual void VIEW::Scene::wheelEvent QWheelEvent *  qmouse_event  )  [protected, virtual]
 

Catch mouse wheel events and zoom the scene accordingly.

Parameters:
e the QT-mouse event (See QT-library for mouse events)

Reimplemented in VIEW::EditableScene.

virtual void VIEW::Scene::writePreferences INIFile inifile  )  throw () [virtual]
 

Writes the widgets preferences to the INIFile.

This method is called automatically by MainControl::aboutToExit at the end of the application.

Parameters:
inifile the INIFile to contain the values
See also:
fetchPreferences

Reimplemented from VIEW::ModularWidget.