BALL
1.4.2
|
#include <BALL/VIEW/WIDGETS/scene.h>
Public Types | |
Type definitions | |
enum | ModeType { ROTATE__MODE = 0, MOVE__MODE, PICKING__MODE } |
enum | ModeAction { TRANSLATE_ACTION, ZOOM_ACTION, ROTATE_ACTION, ROTATE_CLOCKWISE_ACTION } |
Different Mouse Mode actions. More... | |
Enums | |
enum | WindowType { CONTROL_WINDOW = 0, LEFT_EYE_WINDOW, RIGHT_EYE_WINDOW } |
Public Member Functions | |
Constructors and Destructor | |
Scene () | |
Scene (QWidget *parent_widget, const char *name=NULL, Qt::WFlags w_flags=0) | |
Scene (const Scene &scene, QWidget *parent_widget=NULL, const char *name=NULL, Qt::WFlags wflags=0) | |
virtual | ~Scene () |
virtual void | clear () |
Assignment | |
void | set (const Scene &scene) |
const Scene & | operator= (const Scene &scene) |
Accessors: inspectors and mutators | |
virtual void | onNotify (Message *message) |
virtual bool | exportScene (Renderer &er) const |
virtual void | initializeWidget (MainControl &main_control) |
virtual void | fetchPreferences (INIFile &inifile) |
virtual void | writePreferences (INIFile &inifile) |
virtual void | checkMenu (MainControl &main_control) |
Public Member Functions inherited from BALL::VIEW::ModularWidget | |
void | setWorkingDirFromFilename_ (String filename) |
virtual void | showHelp (const String &url) |
ModularWidget (const char *name="<ModularWidget>") | |
ModularWidget (const ModularWidget &widget) | |
virtual | ~ModularWidget () |
virtual void | destroy () |
QAction * | insertMenuEntry (Position parent_id, const String &name, const QObject *receiver=0, const char *slot=0, const String &description="", QKeySequence accel=QKeySequence()) |
void | setMenuHint (const String &hint) |
void | setMenuHelp (const String &url) |
virtual void | registerForHelpSystem (const QObject *object, const String &url) |
void | setIcon (const String &filename, bool add_to_main_toolbar=true) |
bool | lockComposites () |
bool | unlockComposites () |
Unlock the Composites. More... | |
MainControl * | getMainControl () const |
virtual void | setStatusbarText (const String &text, bool important=false) |
virtual void | setStatusbarText (const QString &text, bool important=false) |
More... | |
String | getWorkingDir () |
Implemented for convenience. More... | |
void | setWorkingDir (const String &dir) |
Implemented for convenience. More... | |
FragmentDB & | getFragmentDB () const |
virtual void | finalizeWidget (MainControl &main_control) |
virtual bool | canHandle (const String &) const |
virtual bool | openFile (const String &) |
Public Member Functions inherited from BALL::Embeddable | |
Embeddable (const String &identifier="<Embeddable>") | |
Embeddable (const Embeddable &embeddable) | |
virtual | ~Embeddable () |
void | setIdentifier (const String &identifier) |
const String & | getIdentifier () const |
void | unregisterThis () |
virtual void | registerThis () |
Public Member Functions inherited from BALL::VIEW::ConnectionObject | |
ConnectionObject () | |
virtual | ~ConnectionObject () |
void | registerConnectionObject (ConnectionObject &object) |
void | unregisterConnectionObject (ConnectionObject &object) |
bool | isConnectionObjectRegistered (const ConnectionObject &object) |
ConnectionObject * | getParent () const |
ConnectionObject * | getRoot () |
Protected Slots | |
Protected slots | |
virtual void | rotateMode_ () |
virtual void | pickingMode_ () |
virtual void | moveMode_ () |
virtual void | showViewPoint_ () |
Show the viewpoint and the look at point in the statusline of the mainwidget. More... | |
virtual void | setViewPoint_ () |
Set the viewpoint. More... | |
virtual void | resetCamera_ () |
Reset the camera to standard values. More... | |
virtual void | resetRepresentationsForRenderer_ (RenderSetup &rs) |
virtual void | dropEvent (QDropEvent *e) |
virtual void | dragEnterEvent (QDragEnterEvent *e) |
void | dummySlot () |
Friends | |
class | AnimationThread |
class | RenderSetup |
Debugging and Diagnostics | |
virtual bool | isValid () const |
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
Stage * | getStage () |
const Stage * | getStage () const |
void | setCamera (const Camera &camera) |
std::list< Camera > & | getAnimationPoints () |
void | setDefaultLighting (bool update_GL=true) |
void | initializePreferencesTab (Preferences &preferences) |
void | finalizePreferencesTab (Preferences &preferences) |
virtual void | applyPreferences () |
GLRenderer & | getGLRenderer () |
void | setGLRenderer (GLRenderer &renderer) |
float | getMousePositionX () |
float | getMousePositionY () |
bool | exportPNG (const String &filename) |
virtual void | setWidgetVisible (bool state) |
void | setOffScreenRendering (bool enabled, Size factor) |
virtual void | paintEvent (QPaintEvent *e) |
virtual void | keyPressEvent (QKeyEvent *e) |
Catch key events. More... | |
virtual void | mouseDoubleClickEvent (QMouseEvent *e) |
virtual bool | eventFilter (QObject *object, QEvent *event) |
ModeType | getMode () const |
virtual void | setMode (ModeType mode) |
virtual void | projectionModeChanged () |
void | rotate (float degree_right, float degree_up) |
void | rotateClockwise (float degree) |
void | move (Vector3 v) |
void | moveComposites (const std::list< Composite * > &composites, Vector3 v) |
void | rotateComposites (const std::list< Composite * > &composites, float degree_right, float degree_up, float degree_clockwise=0) |
bool | isAnimationRunning () const |
void | setTurnPoint (const Vector3 &v) |
const Vector3 & | getTurnPoint () const |
void | setFullScreen (bool state) |
void | setFPSEnabled (bool state) |
void | showText (const String &text, Size font_size=20) |
virtual void | addToolBarEntries (QToolBar *tb) |
bool | isUpdateRunning () const |
void | resetTracking () |
bool | inMoveMode () const |
Position | prepareGridTextures (const RegularData3D &grid, const ColorMap &map) |
void | updateGL () |
static void | setAnimationSmoothness (float value) |
static float | getAnimationSmoothness () |
static void | setMouseSensitivity (float sensitivity) |
static float | getMouseSensitivity () |
static void | setMouseWheelSensitivity (float sensitivity) |
static float | getMouseWheelSensitivity () |
static void | setShowLightSources (bool state) |
static bool | showLightSourcesEnabled () |
static bool | stereoBufferSupportTest () |
static void | setScreenShotNumber (Position pos) |
static void | setPOVNumber (Position pos) |
static void | setVRMLNumber (Position pos) |
void | createCoordinateSystem () |
Create an coordinate system at current position. More... | |
void | createCoordinateSystemAtOrigin () |
Create an coordinate system at origin. More... | |
String | exportPNG () |
Export PNG image and return the filename. More... | |
void | exportPOVRay () |
void | exportNextPOVRay () |
Export to POVRay whithout showing file dialog. More... | |
void | printScene () |
void | showExportPNGDialog () |
show an dialog to save an PNG file to More... | |
void | showExportVRMLDialog () |
opens the VIEW/DIALOGS/GeometryExportDialog for vrml and stl export More... | |
void | setPreview (bool state) |
Enable or disable model previews e.g. while rotating. More... | |
bool | usePreview () const |
Returns the state of the preview mode. More... | |
virtual void | switchShowWidget () |
void | addGlWindow () |
void | exitStereo () |
void | enterActiveStereo () |
void | enterDualStereo () |
void | enterDualStereoDifferentDisplays () |
void | clearRecordedAnimation () |
void | startAnimation () |
void | stopAnimation () |
void | switchToLastMode () |
void | switchShowGrid () |
void | showInfos () |
Popup informations for object under mouse cursor. More... | |
void | setupViewVolume () |
void | storeViewPoint () |
void | restoreViewPoint () |
Additional Inherited Members | |
Static Public Member Functions inherited from BALL::VIEW::ModularWidget | |
static void | registerWidget (ModularWidget *mwidget) throw (Exception::NullPointer) |
Protected Member Functions inherited from BALL::VIEW::ConnectionObject | |
void | onNotify_ (Message *message) |
void | notify_ (Message *message) |
void | notify_ (Message &message) |
Static Protected Member Functions inherited from BALL::Embeddable | |
static void | registerInstance_ (const std::type_info &type, const Embeddable *instance) |
static void | unregisterInstance_ (const Embeddable *instance) |
static Size | countInstances_ (const std::type_info &type) |
static Embeddable * | getInstance_ (const std::type_info &type, Position index) |
static Embeddable * | getInstance_ (const std::type_info &type, const String &identifier) |
Protected Attributes inherited from BALL::VIEW::ModularWidget | |
QAction * | window_menu_entry_ |
bool | show_window_enty_ |
bool | default_visible_ |
QAction * | last_action_ |
QList< QAction * > | main_toolbar_actions_ |
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.
Scene may hold several windows for different renering modes. If you need to retrieve a particular window, use this enum together with Scene::getWindow() to get a reference to it.
BALL::VIEW::Scene::Scene | ( | ) |
BALL::VIEW::Scene::Scene | ( | QWidget * | parent_widget, |
const char * | name = NULL , |
||
Qt::WFlags | w_flags = 0 |
||
) |
Default Constructor. Initialize the width and height of this scene to 600
and sets the camera position.
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) |
BALL::VIEW::Scene::Scene | ( | const Scene & | scene, |
QWidget * | parent_widget = NULL , |
||
const char * | name = NULL , |
||
Qt::WFlags | wflags = 0 |
||
) |
Copy constructor. Initialize the width, height and camera position.
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 |
Destructor.
|
slot |
|
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 BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
|
protected |
|
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.
preferences | the Preferences dialog of the MainControl |
Reimplemented from BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
|
protectedvirtual |
Function that interpretes the button press events sent to customEvent()
|
protectedvirtual |
Function that interpretes the button release events sent to customEvent()
|
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.
main_control | the MainControl object whose menus should be checked |
Reimplemented from BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
|
virtual |
Explicit default initialization. Reset the default values of this scene to:
600
600
Vector(1,0,0)
Vector(0,0,0)
Reimplemented from BALL::VIEW::ModularWidget.
|
slot |
|
slot |
Create an coordinate system at current position.
|
protected |
|
slot |
Create an coordinate system at origin.
|
protected |
Estimate current fps and convert into a string.
|
protectedvirtual |
This function handles custom events that for example are sent by the input device drivers
evt | A pointer to the event that shell be processed |
|
protectedvirtualslot |
|
protectedvirtualslot |
|
virtual |
Internal value dump. Dump the current internal state of this scene to the output ostream s with dumping depth depth.
s | output stream where to output the internal state of this scene |
depth | the dumping depth |
Reimplemented from BALL::VIEW::ModularWidget.
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
Export to POVRay whithout showing file dialog.
|
slot |
Export PNG image and return the filename.
|
slot |
|
virtual |
Fetch the widgets preferences from the INIFile. This method is called automatically by MainControl::show() at the start of the application.
inifile | the INIFile that contains the needed values |
Reimplemented from BALL::VIEW::ModularWidget.
|
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.
preferences | the Preferences dialog of the MainControl |
Reimplemented from BALL::VIEW::ModularWidget.
|
inline |
|
inlinestatic |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
protected |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
protectedvirtual |
Initialize the scene and all predefined render setups.
|
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.
preferences | the Preferences dialog of the MainControl |
Reimplemented from BALL::VIEW::ModularWidget.
|
virtual |
ModularWidget methods.Initialize the popup menu Display and the menus of this scene:
main_control | the MainControl object to be initialized with this scene |
Reimplemented from BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
bool BALL::VIEW::Scene::isAnimationRunning | ( | ) | const |
|
virtual |
Internal state and consistency self-validation. A Scene is valid if it has a parent.
Reimplemented from BALL::VIEW::ConnectionObject.
|
virtual |
Catch key events.
Reimplemented in BALL::VIEW::EditableScene.
|
protectedvirtual |
Function that interpretes the motion tracker events sent to customEvent()
|
virtual |
Reimplemented in BALL::VIEW::EditableScene.
|
protectedvirtual |
Catch mouse move events, store the actual mouse position in this scene widget and sent events accordingly.
e | the QT-mouse event (See QT-library for mouse events) |
|
protectedvirtual |
Catch mouse press events, store the actual mouse position in this scene widget and sent events accordingly.
e | the QT-mouse event (See QT-library for mouse events) |
|
protectedvirtual |
Catch mouse release events, store the actual mouse position in this scene widget and sent events accordingly.
e | the QT-mouse event (See QT-library for mouse events) |
void BALL::VIEW::Scene::move | ( | Vector3 | v | ) |
Move the view. \ v.x = right \ v.y = up \ v.z = view direction
Move some Composites. \ v.x = right \ v.y = up \ v.z = view direction
|
protectedvirtualslot |
|
virtual |
Handles messages sent by other registered ConnectionObject objects. Filters for SceneMessage and sets the Camera appropriate or updates the visualization.
message | the pointer to the message that should be processed |
Reimplemented from BALL::VIEW::ConnectionObject.
Reimplemented in BALL::VIEW::EditableScene.
|
virtual |
|
protectedvirtual |
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.
|
protectedvirtualslot |
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.
|
protected |
Position BALL::VIEW::Scene::prepareGridTextures | ( | const RegularData3D & | grid, |
const ColorMap & | map | ||
) |
|
slot |
|
protected |
|
protected |
|
virtual |
|
protected |
|
protectedvirtualslot |
Reset the camera to standard values.
|
protectedvirtualslot |
Rebuffer all representations for the current renderer_. Note: this function does not yet clear the old state of the renderer.
|
protectedvirtual |
Resize the widget. Overridden qt method for resizing this scene. This method will be called automatically every time a rezize event is handled.
width | the new width of this scene |
height | the new height of this scene |
|
slot |
void BALL::VIEW::Scene::rotateClockwise | ( | float | degree | ) |
void BALL::VIEW::Scene::rotateComposites | ( | const std::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
|
protectedvirtualslot |
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.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void BALL::VIEW::Scene::set | ( | const Scene & | scene | ) |
Assignment. Initialize the width, height and camera position.
scene | the scene to be copied |
|
inlinestatic |
void BALL::VIEW::Scene::setCamera | ( | const Camera & | camera | ) |
void BALL::VIEW::Scene::setDefaultLighting | ( | bool | update_GL = true | ) |
void BALL::VIEW::Scene::setFullScreen | ( | bool | state | ) |
void BALL::VIEW::Scene::setGLRenderer | ( | GLRenderer & | renderer | ) |
Set a new GLRenderer. This method is intended for users, that what to overload the behaviour of the GLRenderer.
|
virtual |
Reimplemented in BALL::VIEW::EditableScene.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlineslot |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
slot |
|
protectedvirtualslot |
Set the viewpoint.
|
inlinestatic |
|
virtual |
|
slot |
show an dialog to save an PNG file to
|
slot |
opens the VIEW/DIALOGS/GeometryExportDialog for vrml and stl export
|
slot |
Popup informations for object under mouse cursor.
|
inlinestatic |
Show text in the lower right corner. To clear the text, call this method again with an empty string.
|
protectedvirtualslot |
Show the viewpoint and the look at point in the statusline of the mainwidget.
|
slot |
|
static |
|
slot |
|
slot |
|
slot |
|
virtualslot |
Show or hide widget (Called by menu entry in "WINDOWS") If the ModularWidget is not also a QWidget, this method does nothing
|
slot |
|
protectedvirtual |
Function that interpretes the transformation events sent to customEvent()
|
protected |
void BALL::VIEW::Scene::updateGL | ( | ) |
|
inlineslot |
|
protectedvirtual |
Catch mouse wheel events and zoom the scene accordingly.
e | the QT-mouse event (See QT-library for mouse events) |
|
protected |
|
virtual |
Writes the widgets preferences to the INIFile. This method is called automatically by MainControl::aboutToExit at the end of the application.
inifile | the INIFile to contain the values |
Reimplemented from BALL::VIEW::ModularWidget.
|
protected |
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |