Actin®  Version 5.2.0
Software for Robotics Simulation and Control
Ec::PluginGUI Class Reference

Provides an abstract class to be used as a template for creating dynamically loaded functions. More...

#include <ecPluginGUI.h>

Inheritance diagram for Ec::PluginGUI:
Ec::Plugin Ec::MainWidgetPlugin Ec::ViewerPlugin exampleDockWidgetPlugin exampleGUIPlugin exampleIoDirectionPlugin melodramaPlugin simulationPlugin viewerInteractionPlugin

Public Types

typedef boost::shared_ptr< EcBaseViewerMainWidgetViewerPtr
 Provide a convenient way for plugins to get a shared handle.
 
typedef boost::shared_ptr< const EcBaseViewerMainWidgetConstViewerPtr
 
typedef boost::weak_ptr< EcBaseViewerMainWidgetWeakViewerPtr
 
- Public Types inherited from Ec::Plugin
enum  PluginTraitsEnum {
  TraitDefault = 0x00,
  TraitHardware = 0x01,
  TraitGUI = 0x02,
  TraitRemoteHardware = 0x04,
  TraitPermanent = 0x10,
  TraitWinPermanent = 0x20,
  TraitNoThread = 0x40,
  TraitGUIThread = 0x80,
  TraitCopySystem = 0x100,
  TraitMask = 0x1ff
}
 
typedef EcU32 PluginTraits
 

Public Slots

void setSimulationModified (EcBoolean modified)
 Enables confirm on close.
 
void onSensorInput (EcSG3DInputData *)
 Input device data.
 
virtual void translateUI ()
 

Public Member Functions

EcBoolean initGUI (QMainWindow *pWin, simulationPlugin *pSim)
 
ViewerPtr viewerPtr ()
 
ConstViewerPtr viewerPtr () const
 
virtual void update (const EcReal time) EC_OVERRIDE
 
virtual EcBoolean addMenuToolBarEntry ()
 All the menu actions, toolbar actions for the ui plugin can be added here.
 
template<typename T >
EC_GUICOMMON_VIEWERCORE_DECL T * getPtr (const QString &name="")
 
osg::ref_ptr< osg::Group > getNode (const EcU32 manIndex=-1, const EcU32 linkIndex=-1, const EcBoolean getPrimaryFrame=EcFalse, const EcString &namedFrame="")
 
template<GuiParamTypeEnum prm>
EC_GUICOMMON_VIEWERCORE_DECL EcBoolean connectSignal (const char *value, QObject *owner=NULL)
 
template<GuiParamTypeEnum prm>
EC_GUICOMMON_VIEWERCORE_DECL EcBoolean disconnectSignal (QObject *owner, const char *value)
 
EcBoolean enableWithFile (QObject *obj)
 
EcBoolean disableForReader (QObject *obj)
 
EcBoolean disableOnSimulation (QObject *obj)
 
QWidget * setCentralWidget (QWidget *widget)
 
void addAutoCleanup (QObject *obj)
 
void removeAutoCleanup (QObject *obj)
 Remove the Qt-based object from the auto-cleanup list. More...
 
void addAutoCleanup (osg::Referenced *ref)
 
void addAutoCleanup (osgGA::GUIEventHandler *handler)
 
const QRect screenGeometry () const
 Returns the center of the screen on which the plugin (i.e. Viewer) is displayed.
 
void cleanupOsgObjects ()
 
virtual EcBoolean save (EcBoolean toSave)
 
virtual EcBoolean hasUnsavedData ()
 This API can be used to identify any unsaved data in a plugin.
 
- Public Member Functions inherited from Ec::Plugin
virtual const EcStringpluginName () const
 Retrieve the name of this plugin.
 
virtual PluginTraits traits () const
 Retrieve the type and version number for this plugin.
 
virtual void setConfigurationString (const EcString &str)
 
virtual EcString getConfigurationString () const
 
virtual EcBoolean readConfigurationString (EcXmlReader &stream)
 
virtual EcBoolean writeConfigurationString (EcXmlWriter &stream) const
 
virtual EcBoolean initState ()
 
virtual EcBoolean reset ()
 
virtual EcBoolean shutdown ()
 
EcU32 updatePeriodInMs () const
 
EcBoolean initialized () const
 
void setExtrapolationTime (const EcReal time)
 
EcReal extrapolationTime () const
 
AsyncThreadgetThread ()
 Get a pointer to the Ec::AsyncThread class for real time manipulation.
 
virtual void setIOBuffer (IOBuffer *pBuffer)
 Set a pointer to the IO buffer.
 
virtual IOBuffergetIOBuffer ()
 Get pointer to the IO buffer.
 
virtual const IOBuffergetIOBuffer () const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean setParam (const EcU32 manIndex, const EcU32 subIndex, const EcU32 subSubIndex, const ParamType &value)
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean setParam (const EcU32 manIndex, const EcU32 subIndex, const EcString &key, const ParamType &value)
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean setParam (const EcU32 manIndex, const EcU32 subIndex, const ParamType &value)
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean setParam (const EcU32U32PairVector &manipLinkIndexVector, const ParamType &value)
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean setParam (const EcU32 manIndex, const ParamType &value)
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean setParam (const EcString &key, const ParamType &value)
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean setParam (const ParamType &value)
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean getParam (const EcU32 manIndex, const EcU32 subIndex, const EcU32 subSubIndex, ParamType &value) const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean getParam (const EcU32 manIndex, const EcU32 subIndex, const EcString &key, ParamType &value) const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean getParam (const EcU32 manIndex, const EcU32 subIndex, ParamType &value) const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean getParam (const EcU32U32PairVector &manipLinkIndexVector, ParamType &value) const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean getParam (const EcU32 manIndex, ParamType &value) const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean getParam (const EcString &key, ParamType &value) const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC EcBoolean getParam (ParamType &value) const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC const ParamType param () const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC const ParamType * paramPtr () const
 
template<EcU32 prm, typename ParamType >
EC_PLUGIN_DECL_SPEC boost::shared_ptr< const ParamType > paramScopedPtr () const
 

Protected Member Functions

 PluginGUI ()
 Constructor. Disallow public construction. Use PluginManager::loadPlugin() instead. More...
 
virtual ~PluginGUI ()
 
EcBoolean addDockWidget (Qt::DockWidgetArea area, QDockWidget *pWidget)
 
EcBoolean removeDockWidget (QDockWidget *pWidget)
 
EcBoolean addCustomDockWidget (Qt::DockWidgetArea area, EcDockWidget *pWidget)
 
EcBoolean removeCustomDockWidget (EcDockWidget *pWidget)
 
EcBoolean addToolBar (QToolBar *toolbar, const QString &beforeTB="")
 
EcBoolean addToolBar (Qt::ToolBarArea toolbarArea, QToolBar *toolbar)
 
EcBoolean removeToolBar (QToolBar *toolbar)
 
EcBoolean addToToolBar (QAction *action, const QString &toolbar="miscellaneousToolBar")
 Adds an action to the specified toolbar. More...
 
QAction * addWidgetToToolBar (QWidget *pWidget, Qt::ToolBarArea toolbarArea=Qt::TopToolBarArea, const QString &toolbarName="miscellaneousToolBar")
 Adds the widget to the specified toolbar.
 
EcBoolean addToStatusBar (QWidget *widget, const EcBoolean isPermanent=EcFalse)
 
virtual EcBoolean addTab (QWidget *pWidget, const QString &displayName, const QString &before="")
 
QMenu * getOrAddMenu (const QString &name, const QString &beforeName="")
 
void insertActionInSubMenu (const QString &menuName, const QString &beforeMenuName, QAction *action, const QString &subMenuName)
 Convenience method to add a action in a sub menu under a main menu, If the submenu does not exist, it creates and adds the action. More...
 
QAction * insertActionBefore (const QString &menuName, const QString &beforeMenuName, const QString &actionName, const QString &beforeActionName)
 
QMenu * insertSubMenuBefore (const QString &menuName, const QString &beforeMenuName, const QString &subMenuToInsert, const QString &beforeActionName)
 
- Protected Member Functions inherited from Ec::Plugin
EC_PLUGIN_DECL_SPEC Plugin ()
 Constructor. Disallow public construction. Use PluginManager::loadPlugin() instead.
 
virtual EC_PLUGIN_DECL_SPEC ~Plugin ()
 
virtual EcBoolean init ()
 
virtual void threadingStarted (EcIODataBroker *dataBroker)
 
virtual void threadsStopping (EcIODataBroker *dataBroker)
 
virtual EC_PLUGIN_DECL_SPEC EcString pluginID ()
 

Friends

class Plugin
 Allow upclassing from template methods.
 

Additional Inherited Members

- Static Public Member Functions inherited from Ec::Plugin
static EC_PLUGIN_DECL_SPEC PlugingetPlugin (const EcString &pluginName)
 
static EC_PLUGIN_DECL_SPEC PluginfindPlugin (const EcString &pluginName)
 
- Static Public Attributes inherited from Ec::Plugin
static const EcU8 currentVersion = EC_VERSION_MAJOR
 
- Protected Attributes inherited from Ec::Plugin
EcString m_Name
 Name of the plugin.
 
PluginTraits m_PluginTraits
 Describes the capabilities of this plugin.
 
EcU32 m_UpdatePeriodInMs
 Dictates how often this plugin gets updates.
 
EcStringVector m_RequiredPlugins
 List of plugins that this plugin depends on.
 
EcBoolean m_Initialized
 Whether the plugin initialized properly.
 
IOBufferm_pBuffer
 Internal data caching mechanism.
 
EcU32 m_StatedSystemCopyIndex
 Index of the copy of the stated system used.
 
EcReal m_ExtrapolationTime
 The delta time used for joint position extrapolation.
 
AsyncThreadm_pAsyncThread
 Asynchronous base thread.
 

Detailed Description

Provides an abstract class to be used as a template for creating dynamically loaded functions.

Examples:
exampleGUIPlugin.cpp, and exampleIoDirectionPlugin.cpp.

Definition at line 108 of file ecPluginGUI.h.

Constructor & Destructor Documentation

Ec::PluginGUI::PluginGUI ( )
protected

Constructor. Disallow public construction. Use PluginManager::loadPlugin() instead.

virtual Ec::PluginGUI::~PluginGUI ( )
protectedvirtual

Destructor. Disallow public deletion. Use PluginManager::unloadPlugin() instead. Cleans up any allocated memory.

Member Function Documentation

void Ec::PluginGUI::addAutoCleanup ( QObject *  obj)

Add the Qt-based object to the auto-cleanup list. When the destructor gets called, anything in this list will be deleted.

Parameters
[in]objQt object to destroy when plugin is unloaded
void Ec::PluginGUI::addAutoCleanup ( osg::Referenced *  ref)

Add the OSG-based object to the auto-cleanup list. When the destructor gets called, it will be properly removed depending on its type. Nodes will be detached from all of its parents, and update operations will be removed from their views - effectively reducing the ref count to zero.

Parameters
[in]refOSG handle to clean when plugin is unloaded
void Ec::PluginGUI::addAutoCleanup ( osgGA::GUIEventHandler *  handler)

Add the OSG-based object to the auto-cleanup list. When the destructor gets called, the event handler will be properly removed from the view.

Parameters
[in]handlerEvent handler to cleanup
EcBoolean Ec::PluginGUI::addCustomDockWidget ( Qt::DockWidgetArea  area,
EcDockWidget *  pWidget 
)
protected

Convenience method to add a new EcDockWidget to the viewer that can specify whether it needds to be tabbed or docked. Ownership is transferred for cleanup.

Returns
EcBoolean Returns success or failure of command
Parameters
[in]areaLocation to add it to
[in]pWidgetEcDockWidget to add
EcBoolean Ec::PluginGUI::addDockWidget ( Qt::DockWidgetArea  area,
QDockWidget *  pWidget 
)
protected

Convenience method to add a new dockWidget to the viewer. Ownership is transferred for cleanup.

Returns
EcBoolean Returns success or failure of command
Parameters
[in]areaLocation to add it to
[in]pWidgetQDockWidget to add
virtual EcBoolean Ec::PluginGUI::addTab ( QWidget *  pWidget,
const QString &  displayName,
const QString &  before = "" 
)
protectedvirtual

Convenience method to add a plugin widget to the viewer as a tabbed widget Owership is transferred for cleanup.

Returns
EcBoolean Returns success or failure of command.
Parameters
[in]pWidgetWidget to be tabbed
[in]displayNameDisplay name of tab
[in]beforeOptional name of tab to insert in front of
EcBoolean Ec::PluginGUI::addToolBar ( QToolBar *  toolbar,
const QString &  beforeTB = "" 
)
protected

Convenience method to add a new toolbar to the viewer and insert it into the toolbar menu. Owership is transferred for cleanup.

Returns
EcBoolean Returns success or failure of command.
Parameters
[in]toolbarToolbar to add
[in]beforeTBName of toolbar to insert before.
EcBoolean Ec::PluginGUI::addToolBar ( Qt::ToolBarArea  toolbarArea,
QToolBar *  toolbar 
)
protected

Convenience method to add a new toolbar to the viewer and insert it into the toolbar menu. Owership is transferred for cleanup.

Returns
EcBoolean Returns success or failure of command.
Parameters
[in]toolbarAreaarea where the toolbar is added.
[in]toolbarToolbar to add
EcBoolean Ec::PluginGUI::addToStatusBar ( QWidget *  widget,
const EcBoolean  isPermanent = EcFalse 
)
protected

Adds a widget to the QMainWindow statusBar. Ownership is transerrred for cleanup.

Parameters
[in]widgetWidget to add to statusBar
[in]isPermanentMake permanent or not
EcBoolean Ec::PluginGUI::addToToolBar ( QAction *  action,
const QString &  toolbar = "miscellaneousToolBar" 
)
protected

Adds an action to the specified toolbar.

Parameters
[in]actionAction to add to toolbar
[in]toolbarToolBar to add to
Examples:
exampleGUIPlugin.cpp.
void Ec::PluginGUI::cleanupOsgObjects ( )

FIXME: Meant to be called only when a plugin is unloaded. It will clean up the OSG-based objects in the cleanup list. It decrements the reference count and then inserts an Update Operation to remove the plugin after the scene has been culled of the used geometry.

template<GuiParamTypeEnum prm>
EC_GUICOMMON_VIEWERCORE_DECL EcBoolean Ec::PluginGUI::connectSignal ( const char *  value,
QObject *  owner = NULL 
)

Connects a signal from the associated owner to this plugin.

Template Parameters
prmSignal parameter to connect to
Returns
EcBoolean Success or failure of command
Parameters
[in]valueSignal owner
[in]ownerSlot owner. If NULL, uses 'this'
EcBoolean Ec::PluginGUI::disableOnSimulation ( QObject *  obj)

Adds a connection to this object which sets the disabled state based on when the simulation is running.

Returns
EcBoolean Success or failure of command
Parameters
[in]objQObject to set disabled connection
template<GuiParamTypeEnum prm>
EC_GUICOMMON_VIEWERCORE_DECL EcBoolean Ec::PluginGUI::disconnectSignal ( QObject *  owner,
const char *  value 
)

Disconnects a signal from the associated owner.

Template Parameters
prmSignal parameter to disconnect
Returns
EcBoolean Success or failure of command
Parameters
[in]ownerSignal owner
[in]valueSignal/slot to disconnect
EcBoolean Ec::PluginGUI::enableWithFile ( QObject *  obj)

Adds a connection to this object which sets the enabled state based on whether a file is loaded.

Returns
EcBoolean Success or failure of command
Parameters
[in]objQObject to set enabled connection
Examples:
exampleIoDirectionPlugin.cpp.
osg::ref_ptr<osg::Group> Ec::PluginGUI::getNode ( const EcU32  manIndex = -1,
const EcU32  linkIndex = -1,
const EcBoolean  getPrimaryFrame = EcFalse,
const EcString namedFrame = "" 
)

Parameters
[in]manIndexManipulator link, -1 for root
[in]linkIndexLink index, -1 for base
[in]getPrimaryFrameWhether to get the primary frame node or not
QMenu* Ec::PluginGUI::getOrAddMenu ( const QString &  name,
const QString &  beforeName = "" 
)
protected

Convenience method to add a menu to the main menubar or retrieve

Returns
QMenu* Handle to menu created or reused if already present
Parameters
[in]nameDisplay name of menu
[in]beforeNameOptional name of menu to insert in front of
template<typename T >
EC_GUICOMMON_VIEWERCORE_DECL T* Ec::PluginGUI::getPtr ( const QString &  name = "")

Retrieves a pointer to a main window object type.

Returns
T* Pointer to a valid object or EcNULL on failure
Parameters
[in]nameName of the object to retrieve, if not unique
EcBoolean Ec::PluginGUI::initGUI ( QMainWindow *  pWin,
simulationPlugin pSim 
)

Sets internal pointer for use later on.

Returns
EcBoolean Success or failure of command
Parameters
[in]pWinHandle to window object
[in]pSimHandle to simulation
QAction* Ec::PluginGUI::insertActionBefore ( const QString &  menuName,
const QString &  beforeMenuName,
const QString &  actionName,
const QString &  beforeActionName 
)
protected

Convenience method to add a action in a a main menu but before a certain menu item

Returns
QAction* Handle to action created or reused if already present
Parameters
[in]menuNameDisplay name of main menu under which action has to be added
[in]beforeMenuNameDisplay name of main menu name that appears before the name specified by first parameter
[in]actionNameDisplay name of action to be added
[in]beforeActionNameDisplay name of action or menu item name under the main menu before which we want to add the action
void Ec::PluginGUI::insertActionInSubMenu ( const QString &  menuName,
const QString &  beforeMenuName,
QAction *  action,
const QString &  subMenuName 
)
protected

Convenience method to add a action in a sub menu under a main menu, If the submenu does not exist, it creates and adds the action.

Parameters
[in]menuNameDisplay name of main menu
[in]beforeMenuNameDisplay name of menu item before the main menu that appears in the main menu
[in]actionThe Action to be added to the submenu
[in]subMenuNameDisplay name of sub menu under the main menu for which we want to add the action
QMenu* Ec::PluginGUI::insertSubMenuBefore ( const QString &  menuName,
const QString &  beforeMenuName,
const QString &  subMenuToInsert,
const QString &  beforeActionName 
)
protected

Convenience method to add a sub menu under a main menu before a certain item in the main menu

Returns
QMenu* Handle to menu created or reused if already present
Parameters
[in]menuNameDisplay name of main menu under which sub menu has to be added
[in]beforeMenuNameDisplay name of main menu name that appears before the name specified by first parameter
[in]subMenuToInsertDisplay name of sub menu to be added
[in]beforeActionNameDisplay name of item (action/submenu) under the main menu before which we want to add the submenu
void Ec::PluginGUI::removeAutoCleanup ( QObject *  obj)

Remove the Qt-based object from the auto-cleanup list.

Parameters
[in]objQt object to destroy when plugin is unloaded
EcBoolean Ec::PluginGUI::removeCustomDockWidget ( EcDockWidget *  pWidget)
protected

Convenience method to remove a EcDockWidget from the viewer.

Returns
EcBoolean Returns success or failure of command
Parameters
[in]pWidgetEcDockWidget to add
EcBoolean Ec::PluginGUI::removeDockWidget ( QDockWidget *  pWidget)
protected

Convenience method to remove a dockWidget from the viewer.

Returns
EcBoolean Returns success or failure of command
Parameters
[in]pWidgetQDockWidget to add
EcBoolean Ec::PluginGUI::removeToolBar ( QToolBar *  toolbar)
protected

Convenience method to remove a toolbar

Returns
EcBoolean Returns success or failure of command.
virtual EcBoolean Ec::PluginGUI::save ( EcBoolean  toSave)
inlinevirtual

This will be called when application exits or when current simulation file is closed allowing any changes in the plugin objects to be saved or cleaned Any plugin that wants to save any object should override this method

Definition at line 262 of file ecPluginGUI.h.

References EcTrue.

QWidget* Ec::PluginGUI::setCentralWidget ( QWidget *  widget)

Replace the existing central widget with this one. The previously-set one will be deleted. This method tries to reparent the viewer widget beforehand. Most layout or tabbed widget will need to manually add this, which is why it is returned as well.

Returns
QWidget* Handle to central widget
Parameters
[in]widgetCentral widget to swap in
virtual void Ec::PluginGUI::update ( const EcReal  time)
inlinevirtual

This method will be called at the proper update rate specified.

Parameters
timeCurrent simulation timestep Concrete implementation of plugin update method.

Implements Ec::Plugin.

Examples:
exampleIoDirectionPlugin.cpp.

Definition at line 140 of file ecPluginGUI.h.

ViewerPtr Ec::PluginGUI::viewerPtr ( )
inline

Provide safe access to the viewer handle.

Returns
ViewerPtr Access to viewer handle or NULL if unavailable

Definition at line 129 of file ecPluginGUI.h.

ConstViewerPtr Ec::PluginGUI::viewerPtr ( ) const
inline

Provide safe access to the viewer handle.

Returns
ConstViewerPtr Access to viewer handle or NULL if unavailable

Definition at line 135 of file ecPluginGUI.h.


The documentation for this class was generated from the following file:
Created by Energid Technologies www.energid.com
Copyright © 2016 Energid. All trademarks mentioned in this document are property of their respective owners.