MouseAndKeyPlugin Class Reference

Inheritance diagram for MouseAndKeyPlugin:
Inheritance graph
[legend]
Collaboration diagram for MouseAndKeyPlugin:
Collaboration graph
[legend]

List of all members.

Public Slots

QString version ()
 Return a version string for your plugin.

Signals

void updateView ()
 Update current view in Main Application.
void updatedObject (int _id)
 An object has been changed or added by this plugin.
void visibilityChanged (int _id)
 An object has been shown or hidden.
void log (Logtype _type, QString _message)
void log (QString _message)
void addContextMenuItem (QAction *_action, ContextMenuType _type)
 Add an entry for a context Menu.
void addContextMenuItem (QAction *_action, DataType _objectType, ContextMenuType _type)
 Add an entry for a context Menu.
void addPickMode (const std::string _mode)
 Add a new picking mode to the examiner.
void addHiddenPickMode (const std::string _mode)
 Add a new picking mode to the examiner which will be invisible.
void registerKey (int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse=false)
 Register a key-combination for your plugin.
void addToolbox (QString _name, QWidget *_widget)
 Add a toolbox widget to the gui with the given name.

Public Member Functions

QString name ()
 Return a name for the plugin.
QString description ()
 Return a description of what the plugin is doing.

Private Slots

void initializePlugin ()
 Initialize Plugin.
void pluginsInitialized ()
 Initialize Plugin step 2.
void slotMouseEvent (QMouseEvent *_event)
 Mouse Event from Main App ( Picking Mode ).
void slotKeyEvent (QKeyEvent *_event)
 Key Event from Main App.
void slotPickModeChanged (const std::string &_mode)
 The pickingMode has changed.
void slotButtonClicked ()
void contextMenuItemSelected (QAction *_action)

Private Member Functions

template<typename MeshT >
void transformMesh (ACG::Matrix4x4d _mat, MeshT &_mesh)

Private Attributes

QMenu * contextMenuEntry_
QWidget * tool_
QPushButton * pickButton_
int activeObject_
ACG::Vec3d axis_x_
ACG::Vec3d axis_y_

Detailed Description

Definition at line 13 of file MouseAndKeyPlugin.hh.


Member Function Documentation

void MouseAndKeyPlugin::addContextMenuItem ( QAction *  ,
DataType  ,
ContextMenuType   
) [virtual, signal]

Add an entry for a context Menu.

Create an action (Can also be the action of a Menu) and register this action as a context menu entry to the core. This Action will only be visible if the picked object is of the given datatype. To support multiple object types with your menu, you can emit this signal multiple times with the same action but different DataTypes. You can add a whole Menu here by adding the action: menu->menuAction()

Parameters:
_action Pointer to the new action
_objectType Type of the picked object
_type Type of the context Menu ( See ContextMenuType )

Reimplemented from ContextMenuInterface.

void MouseAndKeyPlugin::addContextMenuItem ( QAction *  ,
ContextMenuType   
) [virtual, signal]

Add an entry for a context Menu.

Create an Action (Can also be the action of a Menu) and register this menu as a context menu to the core. This Action will be visible when you rightclick in the viewer widget on an item of the given context menu type. You can add a whole menu here by adding the action: menu->menuAction() of your own menu.

Parameters:
_menu Pointer to the new Action

Reimplemented from ContextMenuInterface.

Referenced by pluginsInitialized().

void MouseAndKeyPlugin::addHiddenPickMode ( const std::string   )  [virtual, signal]

Add a new picking mode to the examiner which will be invisible.

The added PickMode will not appear in the context menus Picking menu. You have to provide a button or menuentry yourself if you want to switch to the picking mode provided here.

Parameters:
_mode Identifier of Picking mode or "Separator" to add a Separator

Reimplemented from PickingInterface.

void MouseAndKeyPlugin::addPickMode ( const std::string   )  [virtual, signal]

Add a new picking mode to the examiner.

Parameters:
_mode Identifier of Picking mode or "Separator" to add a Separator

Reimplemented from PickingInterface.

Referenced by pluginsInitialized().

void MouseAndKeyPlugin::addToolbox ( QString  ,
QWidget *   
) [virtual, signal]

Add a toolbox widget to the gui with the given name.

This signal adds a toolbox widget to the toolbar on the right.

Reimplemented from ToolboxInterface.

Referenced by initializePlugin().

QString MouseAndKeyPlugin::description (  )  [inline, virtual]

Return a description of what the plugin is doing.

This function has to return a basic description of the plugin

Implements BaseInterface.

Definition at line 66 of file MouseAndKeyPlugin.hh.

void MouseAndKeyPlugin::initializePlugin (  )  [private, virtual, slot]

Initialize Plugin.

This slot is called if the plugin is loaded and has to be initialized. All initialization stuff in this slot has to stay inside the plugin, no external signals are allowed here (and will be ignored). Don't create any objects via pluginfunctions here. Use the pluginsInitialized() slot for external initialization. After execution of this slot your plugin should be fully functional. Only gui elements may be uninitialized and should be created in pluginsInitialized().

Reimplemented from BaseInterface.

Definition at line 43 of file MouseAndKeyPlugin.cc.

References addToolbox(), and registerKey().

void MouseAndKeyPlugin::log ( QString   )  [virtual, signal]

Send a log message to the mainwindow of the widget
defaults to LOGOUT message type

Parameters:
_message Message to be displayed

Implements LoggingInterface.

void MouseAndKeyPlugin::log ( Logtype  ,
QString   
) [virtual, signal]

Send a log message to the mainwindow of the widget

Parameters:
_type Message type (LOGINFO,LOGOUT,LOGWARN,LOGERR)
_message Message to be displayed

Implements LoggingInterface.

Referenced by slotKeyEvent(), and slotMouseEvent().

QString MouseAndKeyPlugin::name (  )  [inline, virtual]

Return a name for the plugin.

This Function has to return the name of the plugin.

Implements BaseInterface.

Definition at line 65 of file MouseAndKeyPlugin.hh.

void MouseAndKeyPlugin::pluginsInitialized (  )  [private, virtual, slot]

Initialize Plugin step 2.

This slot is called if all plugins are loaded and the core is ready. Here you can create objects, set Textures and everything which will involve signals to the core.

Reimplemented from BaseInterface.

Definition at line 89 of file MouseAndKeyPlugin.cc.

References addContextMenuItem(), addPickMode(), DATA_POLY_MESH, and DATA_TRIANGLE_MESH.

void MouseAndKeyPlugin::registerKey ( int  ,
Qt::KeyboardModifiers  ,
QString  ,
bool  = false 
) [virtual, signal]

Register a key-combination for your plugin.

To obtain key events from the viewer for a certain key-combination, you have to register that combination first

Parameters:
_key the key that should be registered
_modifiers the keyboard modifiers
_description a short description about the functionality
_multiUse can the key additionally be registered by another plugin

Reimplemented from KeyInterface.

Referenced by initializePlugin().

void MouseAndKeyPlugin::slotKeyEvent ( QKeyEvent *   )  [private, virtual, slot]

Key Event from Main App.

This slot is called if a key event occured in the Viewer

Parameters:
_event Keyevent

Reimplemented from KeyInterface.

Definition at line 204 of file MouseAndKeyPlugin.cc.

References DATA_POLY_MESH, DATA_TRIANGLE_MESH, BaseObject::dataType(), PluginFunctions::getPickedObject(), BaseObject::id(), log(), BaseObjectData::manipulatorNode(), ACG::SceneGraph::TransformNode::matrix(), PluginFunctions::polyMesh(), PluginFunctions::triMesh(), updatedObject(), and updateView().

void MouseAndKeyPlugin::slotMouseEvent ( QMouseEvent *   )  [private, virtual, slot]

Mouse Event from Main App ( Picking Mode ).

This slot is called if a mouse event occured in the Viewer This slot will only get called in pickingMode. Right button clicks will not be passed to the plugins as this is reserved for the context Menu.

Parameters:
_event Mousevent

Reimplemented from MouseInterface.

Definition at line 150 of file MouseAndKeyPlugin.cc.

References PluginFunctions::actionMode(), PluginFunctions::getPickedObject(), log(), ACG::SceneGraph::PICK_ANYTHING, PluginFunctions::pickMode(), PluginFunctions::scenegraphPick(), and PluginFunctions::traverse().

void MouseAndKeyPlugin::slotPickModeChanged ( const std::string &   )  [private, virtual, slot]

The pickingMode has changed.

This slot is called if the user changes the current picking mode

Parameters:
_mode Identifier of Picking mode

Reimplemented from PickingInterface.

Definition at line 139 of file MouseAndKeyPlugin.cc.

void MouseAndKeyPlugin::updatedObject ( int   )  [virtual, signal]

An object has been changed or added by this plugin.

Emit this Signal, if you updated any part of an object.
If you changed the element itself (geometry, topology,..) you also have to emit this signal.
Dont emit this Signal in BaseInterface::slotObjectUpdated() as this causes an endless Loop!! Give the id of the new object as parameter or -1 if you updated all objects or deleted an object.

The parameter has to be the id of the object or -1 if refering to all or deleted objects.

Reimplemented from BaseInterface.

Referenced by slotKeyEvent().

void MouseAndKeyPlugin::updateView (  )  [virtual, signal]

Update current view in Main Application.

Emit this Signal if the viewer widget in the main application should update the current view. If you do an updatedObject the core will trigger an update itself and you don't have to care about it.

Reimplemented from BaseInterface.

Referenced by slotKeyEvent().

QString MouseAndKeyPlugin::version (  )  [inline, virtual, slot]

Return a version string for your plugin.

This function will be used to determin the current version of your plugin. Should have the form x.x.x ( you do not need to give that many subversions )

Reimplemented from BaseInterface.

Definition at line 97 of file MouseAndKeyPlugin.hh.

void MouseAndKeyPlugin::visibilityChanged ( int   )  [virtual, signal]

An object has been shown or hidden.

Emit this Signal, if you changed the visibility of an object. This is required to reset the near and far plane for the viewers to provide an optimal view. Use the id of the object you show or hide as a parameter. Otherwise use -1 if you dont have the id.

Reimplemented from BaseInterface.


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

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