SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::gui::qt::RealGUI Class Reference

#include <RealGUI.h>

Inheritance diagram for sofa::gui::qt::RealGUI:

Public Attributes

QSofaListViewsimulationGraph
 

Protected Attributes

QLabel * fpsLabel
 
QLabel * timeLabel
 
bool mCreateViewersOpt
 create a viewer by default, otherwise you have to manage your own viewer More...
 
bool mIsEmbeddedViewer
 
bool m_dumpState
 
std::ofstream * m_dumpStateStream
 
std::ostringstream m_dumpVisitorStream
 
bool m_exportGnuplot
 
bool _animationOBJ
 
int _animationOBJcounter
 
bool m_displayComputationTime
 
bool m_fullScreen
 
BaseViewermViewer
 
clock_t m_clockBeforeLastStep
 
QDisplayPropertyWidgetpropertyWidget
 
std::map< helper::SofaViewerFactory::Key, QAction * > viewerMap
 list of all viewer key name (for creation) mapped to its QAction in the GUI More...
 
InformationOnPickCallBack informationOnPickCallBack
 
QWidgetcurrentTab
 
QSofaStatWidgetstatWidget
 
QTimer * timerStep
 
QTimer * timerIdle
 
WDoubleLineEditbackground [3]
 
QLineEditbackgroundImage
 
SofaPluginManagerpluginManager_dialog
 
QMenuFilesRecentlyOpened recentlyOpenedFilesManager
 
std::string simulation_name
 
std::string gnuplot_directory
 
std::string pathDumpVisitor
 
std::set< std::string > m_modifiedLogFiles
 Keep track of log files that have been modified since the GUI started. More...
 
bool m_enableInteraction {false}
 
sofa::simulation::Node::SPtr mSimulation
 
sofa::helper::system::FileEventListenerm_filelistener {nullptr}
 

Public Member Functions

 RealGUI (const char *viewername)
 
 ~RealGUI () override
 
void showFPS (double fps) override
 Force the displayed FPS value (if any) More...
 
void stepMainLoop () override
 
int mainLoop () override
 
int closeGUI () override
 Close the GUI. More...
 
sofa::simulation::NodecurrentSimulation () override
 Get the rootNode of the sofa scene. More...
 
virtual void fileOpen (std::string filename, bool temporaryFile=false, bool reload=false)
 
virtual void fileOpenSimu (std::string filename)
 
virtual void setScene (Node::SPtr groot, const char *filename=nullptr, bool temporaryFile=false) override
 Register the scene in our GUI. More...
 
virtual void setSceneWithoutMonitor (Node::SPtr groot, const char *filename=nullptr, bool temporaryFile=false)
 
virtual void unloadScene (bool _withViewer=true)
 
virtual void setTitle (std::string windowTitle)
 
virtual void fileSaveAs (Node *node, const char *filename)
 
void setViewerResolution (int w, int h) override
 
void setFullScreen () override
 
virtual void setFullScreen (bool enable)
 
void setBackgroundColor (const sofa::helper::types::RGBAColor &c) override
 
virtual void setBackgroundImage (const std::string &i) override
 
void setViewerConfiguration (sofa::component::configurationsetting::ViewerSetting *viewerConf) override
 
void setMouseButtonConfiguration (sofa::component::configurationsetting::MouseButtonSetting *button) override
 
void setDumpState (bool) override
 
void setLogTime (bool) override
 
void setExportState (bool) override
 
virtual void setRecordPath (const std::string &path) override
 
virtual void setGnuplotPath (const std::string &path) override
 
virtual void createViewer (const char *_viewerName, bool _updateViewerList=false)
 
void registerViewer (BaseViewer *_viewer) override
 Used to directly replace the current viewer. More...
 
BaseViewergetViewer () override
 
sofa::gui::qt::viewer::SofaViewergetQtViewer ()
 
bool isEmbeddedViewer ()
 Our viewer is a QObject SofaViewer. More...
 
virtual void removeViewer ()
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
- Public Member Functions inherited from sofa::gui::BaseGUI
virtual void configureGUI (sofa::simulation::Node::SPtr groot)
 Use a component setting to configure our GUI. More...
 
void exportGnuplot (sofa::simulation::Node *node, std::string gnuplot_directory="")
 
virtual void redraw ()=0
 Update the GUI. More...
 
virtual bool saveScreenshot (const std::string &filename, int compression_level=-1)
 
virtual void sendMessage (const std::string &, const std::string &)
 Send a (script) message. More...
 

Static Public Member Functions

static BaseGUICreateGUI (const char *name, sofa::simulation::Node::SPtr groot=nullptr, const char *filename=nullptr)
 
static void SetPixmap (std::string pixmap_filename, QPushButton *b)
 
- Static Public Member Functions inherited from sofa::gui::BaseGUI
static std::string & GetGUIName ()
 
static const char * GetProgramName ()
 
static void SetProgramName (const char *argv0)
 
static void SetArgumentParser (ArgumentParser *parser)
 
static const std::string & getConfigDirectoryPath ()
 
static const std::string & getScreenshotDirectoryPath ()
 
static void setConfigDirectoryPath (const std::string &path, bool createIfNecessary=false)
 
static void setScreenshotDirectoryPath (const std::string &path, bool createIfNecessary=false)
 

Protected Member Functions

void init ()
 init data member from RealGUI for the viewer initialisation in the GUI More...
 
void createDisplayFlags (Node::SPtr root)
 
void loadSimulation (bool one_step=false)
 
void eventNewStep ()
 
void eventNewTime ()
 
void keyPressEvent (QKeyEvent *e) override
 
void startDumpVisitor ()
 
void stopDumpVisitor ()
 
void initViewer (BaseViewer *_viewer) override
 init the viewer for the GUI (embeded or not we have to connect some info about viewer in the GUI) More...
 
void isEmbeddedViewer (bool _onOff)
 Our viewer is a QObject SofaViewer. More...
 
virtual int exitApplication (unsigned int _retcode=0)
 
void sleep (float seconds, float init_time)
 
- Protected Member Functions inherited from sofa::gui::BaseGUI
 BaseGUI ()
 
virtual ~BaseGUI ()
 The destructor should not be called directly. Use the closeGUI() method instead. More...
 

Static Protected Member Functions

static void CreateApplication (int _argc=0, char **_argv=nullptr)
 
static void InitApplication (RealGUI *_gui)
 

Signals

void reload ()
 
void newScene ()
 
void newStep ()
 
void quit ()
 

Public Slots

virtual void NewRootNode (sofa::simulation::Node *root, const char *path)
 
virtual void ActivateNode (sofa::simulation::Node *, bool)
 
virtual void setSleepingNode (sofa::simulation::Node *, bool)
 
virtual void fileSaveAs (sofa::simulation::Node *node)
 
virtual void LockAnimation (bool)
 
virtual void fileRecentlyOpened (QAction *action)
 
virtual void playpauseGUI (bool value)
 
virtual void interactionGUI (bool value)
 
virtual void step ()
 
virtual void emitIdle ()
 
virtual void setDt (const QString &)
 
virtual void updateDtEditState ()
 
virtual void resetScene ()
 
virtual void screenshot ()
 
virtual void showhideElements ()
 
virtual void Update ()
 
virtual void updateBackgroundColour ()
 
virtual void updateBackgroundImage ()
 
virtual void resetView ()
 
virtual void saveView ()
 
virtual void setSizeW (int _valW)
 
virtual void setSizeH (int _valH)
 
virtual void clear ()
 
void redraw () override
 refresh the visualization window More...
 
virtual void exportOBJ (sofa::simulation::Node *node, bool exportMTL=true)
 
virtual void dumpState (bool)
 
virtual void displayComputationTime (bool)
 
virtual void setExportGnuplot (bool)
 
virtual void setExportVisitor (bool)
 
virtual void displayProflierWindow (bool)
 
virtual void currentTabChanged (int index)
 
virtual void fileNew ()
 
virtual void popupOpenFileSelector ()
 This open popup the file selection windows. More...
 
virtual void fileReload ()
 
virtual void fileSave ()
 
virtual void fileExit ()
 
virtual void fileSaveAs ()
 
virtual void helpAbout ()
 
virtual void editRecordDirectory ()
 
virtual void editGnuplotDirectory ()
 
virtual void showDocBrowser ()
 
virtual void showPluginManager ()
 
virtual void showMouseManager ()
 
virtual void showVideoRecorderManager ()
 
virtual void showWindowDataGraph ()
 
virtual void toolsDockMoved ()
 

Protected Slots

virtual void changeViewer ()
 
virtual void updateViewerList ()
 
void propertyDockMoved (Qt::DockWidgetArea a)
 
void appendToDataLogFile (QString)
 
void docBrowserVisibilityChanged (bool)
 

Additional Inherited Members

- Static Protected Attributes inherited from sofa::gui::BaseGUI
static std::string mGuiName = ""
 
static std::string configDirectoryPath = "."
 
static std::string screenshotDirectoryPath = "."
 
static const char * mProgramName = nullptr
 
static ArgumentParsermArgumentParser = nullptr
 

Attribute details

bool sofa::gui::qt::RealGUI::_animationOBJ
protected
int sofa::gui::qt::RealGUI::_animationOBJcounter
protected
WDoubleLineEdit* sofa::gui::qt::RealGUI::background[3]
protected
QLineEdit* sofa::gui::qt::RealGUI::backgroundImage
protected
QWidget* sofa::gui::qt::RealGUI::currentTab
protected
QLabel* sofa::gui::qt::RealGUI::fpsLabel
protected
std::string sofa::gui::qt::RealGUI::gnuplot_directory
protected
InformationOnPickCallBack sofa::gui::qt::RealGUI::informationOnPickCallBack
protected
clock_t sofa::gui::qt::RealGUI::m_clockBeforeLastStep
protected
bool sofa::gui::qt::RealGUI::m_displayComputationTime
protected
bool sofa::gui::qt::RealGUI::m_dumpState
protected
std::ofstream* sofa::gui::qt::RealGUI::m_dumpStateStream
protected
std::ostringstream sofa::gui::qt::RealGUI::m_dumpVisitorStream
protected
bool sofa::gui::qt::RealGUI::m_enableInteraction {false}
protected
bool sofa::gui::qt::RealGUI::m_exportGnuplot
protected
sofa::helper::system::FileEventListener* sofa::gui::qt::RealGUI::m_filelistener {nullptr}
protected
bool sofa::gui::qt::RealGUI::m_fullScreen
protected
std::set<std::string> sofa::gui::qt::RealGUI::m_modifiedLogFiles
protected

Keep track of log files that have been modified since the GUI started.

bool sofa::gui::qt::RealGUI::mCreateViewersOpt
protected

create a viewer by default, otherwise you have to manage your own viewer

bool sofa::gui::qt::RealGUI::mIsEmbeddedViewer
protected
sofa::simulation::Node::SPtr sofa::gui::qt::RealGUI::mSimulation
protected
BaseViewer* sofa::gui::qt::RealGUI::mViewer
protected
std::string sofa::gui::qt::RealGUI::pathDumpVisitor
protected
SofaPluginManager* sofa::gui::qt::RealGUI::pluginManager_dialog
protected
QDisplayPropertyWidget* sofa::gui::qt::RealGUI::propertyWidget
protected
QMenuFilesRecentlyOpened sofa::gui::qt::RealGUI::recentlyOpenedFilesManager
protected
std::string sofa::gui::qt::RealGUI::simulation_name
protected
QSofaListView* sofa::gui::qt::RealGUI::simulationGraph
QSofaStatWidget* sofa::gui::qt::RealGUI::statWidget
protected
QLabel* sofa::gui::qt::RealGUI::timeLabel
protected
QTimer* sofa::gui::qt::RealGUI::timerIdle
protected
QTimer* sofa::gui::qt::RealGUI::timerStep
protected
std::map< helper::SofaViewerFactory::Key, QAction* > sofa::gui::qt::RealGUI::viewerMap
protected

list of all viewer key name (for creation) mapped to its QAction in the GUI

Constructor details

sofa::gui::qt::RealGUI::RealGUI ( const char *  viewername)
sofa::gui::qt::RealGUI::~RealGUI ( )
override

Function details

void sofa::gui::qt::RealGUI::ActivateNode ( sofa::simulation::Node node,
bool  activate 
)
virtualslot
void sofa::gui::qt::RealGUI::appendToDataLogFile ( QString  dataModifiedString)
protectedslot
void sofa::gui::qt::RealGUI::changeViewer ( )
protectedvirtualslot

Allow to dynamicly change viewer. Called when click on another viewer in GUI Qt viewer list (see viewerMap). TODO: find a better way to propagate the argument when we construct the viewer

void sofa::gui::qt::RealGUI::clear ( )
virtualslot
int sofa::gui::qt::RealGUI::closeGUI ( )
overridevirtual

Close the GUI.

Implements sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::CreateApplication ( int  _argc = 0,
char **  _argv = nullptr 
)
staticprotected
void sofa::gui::qt::RealGUI::createDisplayFlags ( Node::SPtr  root)
protected
BaseGUI * sofa::gui::qt::RealGUI::CreateGUI ( const char *  name,
sofa::simulation::Node::SPtr  groot = nullptr,
const char *  filename = nullptr 
)
static
void sofa::gui::qt::RealGUI::createViewer ( const char *  _viewerName,
bool  _updateViewerList = false 
)
virtual

create a viewer according to the argument key

Note
the viewerMap have to be initialize at least once before
  • _updateViewerList is used only if you want to reactualise the viewerMap in the GUI TODO: find a better way to propagate the argument when we construct the viewer
sofa::simulation::Node * sofa::gui::qt::RealGUI::currentSimulation ( )
overridevirtual

Get the rootNode of the sofa scene.

Implements sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::currentTabChanged ( int  index)
virtualslot
void sofa::gui::qt::RealGUI::displayComputationTime ( bool  value)
virtualslot
void sofa::gui::qt::RealGUI::displayProflierWindow ( bool  value)
virtualslot
void sofa::gui::qt::RealGUI::docBrowserVisibilityChanged ( bool  visibility)
protectedslot
void sofa::gui::qt::RealGUI::dragEnterEvent ( QDragEnterEvent *  event)
override
void sofa::gui::qt::RealGUI::dropEvent ( QDropEvent *  event)
override
void sofa::gui::qt::RealGUI::dumpState ( bool  value)
virtualslot
void sofa::gui::qt::RealGUI::editGnuplotDirectory ( )
virtualslot
void sofa::gui::qt::RealGUI::editRecordDirectory ( )
virtualslot
void sofa::gui::qt::RealGUI::emitIdle ( )
virtualslot
void sofa::gui::qt::RealGUI::eventNewStep ( )
protected
void sofa::gui::qt::RealGUI::eventNewTime ( )
protected
virtual int sofa::gui::qt::RealGUI::exitApplication ( unsigned int  _retcode = 0)
inlineprotectedvirtual
void sofa::gui::qt::RealGUI::exportOBJ ( sofa::simulation::Node node,
bool  exportMTL = true 
)
virtualslot
void sofa::gui::qt::RealGUI::fileExit ( )
virtualslot
void sofa::gui::qt::RealGUI::fileNew ( )
virtualslot
void sofa::gui::qt::RealGUI::fileOpen ( std::string  filename,
bool  temporaryFile = false,
bool  reload = false 
)
virtual
void sofa::gui::qt::RealGUI::fileOpenSimu ( std::string  filename)
virtual
void sofa::gui::qt::RealGUI::fileRecentlyOpened ( QAction *  action)
virtualslot
void sofa::gui::qt::RealGUI::fileReload ( )
virtualslot
void sofa::gui::qt::RealGUI::fileSave ( )
virtualslot
void sofa::gui::qt::RealGUI::fileSaveAs ( Node node,
const char *  filename 
)
virtual
void sofa::gui::qt::RealGUI::fileSaveAs ( sofa::simulation::Node node)
virtualslot
virtual void sofa::gui::qt::RealGUI::fileSaveAs ( )
inlinevirtualslot
sofa::gui::qt::viewer::SofaViewer * sofa::gui::qt::RealGUI::getQtViewer ( )

A way to know if our viewer is embedded or not... (see initViewer) TODO: Find a better way to do this

BaseViewer * sofa::gui::qt::RealGUI::getViewer ( )
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

virtual void sofa::gui::qt::RealGUI::helpAbout ( )
inlinevirtualslot
void sofa::gui::qt::RealGUI::init ( void  )
protected

init data member from RealGUI for the viewer initialisation in the GUI

void sofa::gui::qt::RealGUI::InitApplication ( RealGUI _gui)
staticprotected
void sofa::gui::qt::RealGUI::initViewer ( BaseViewer _viewer)
overrideprotectedvirtual

init the viewer for the GUI (embeded or not we have to connect some info about viewer in the GUI)

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::interactionGUI ( bool  value)
virtualslot
bool sofa::gui::qt::RealGUI::isEmbeddedViewer ( )

Our viewer is a QObject SofaViewer.

void sofa::gui::qt::RealGUI::isEmbeddedViewer ( bool  _onOff)
inlineprotected

Our viewer is a QObject SofaViewer.

void sofa::gui::qt::RealGUI::keyPressEvent ( QKeyEvent *  e)
overrideprotected
void sofa::gui::qt::RealGUI::loadSimulation ( bool  one_step = false)
protected
void sofa::gui::qt::RealGUI::LockAnimation ( bool  value)
virtualslot
int sofa::gui::qt::RealGUI::mainLoop ( )
overridevirtual

Implements sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::NewRootNode ( sofa::simulation::Node root,
const char *  path 
)
virtualslot
void sofa::gui::qt::RealGUI::newScene ( )
signal
void sofa::gui::qt::RealGUI::newStep ( )
signal
void sofa::gui::qt::RealGUI::playpauseGUI ( bool  value)
virtualslot
void sofa::gui::qt::RealGUI::popupOpenFileSelector ( )
virtualslot

This open popup the file selection windows.

void sofa::gui::qt::RealGUI::propertyDockMoved ( Qt::DockWidgetArea  a)
protectedslot
void sofa::gui::qt::RealGUI::quit ( )
signal
void sofa::gui::qt::RealGUI::redraw ( )
overrideslot

refresh the visualization window

void sofa::gui::qt::RealGUI::registerViewer ( BaseViewer _viewer)
overridevirtual

Used to directly replace the current viewer.

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::reload ( )
signal
void sofa::gui::qt::RealGUI::removeViewer ( )
virtual
void sofa::gui::qt::RealGUI::resetScene ( )
virtualslot
virtual void sofa::gui::qt::RealGUI::resetView ( )
inlinevirtualslot
virtual void sofa::gui::qt::RealGUI::saveView ( )
inlinevirtualslot
void sofa::gui::qt::RealGUI::screenshot ( )
virtualslot
void sofa::gui::qt::RealGUI::setBackgroundColor ( const sofa::helper::types::RGBAColor c)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setBackgroundImage ( const std::string &  i)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setDt ( const QString &  value)
virtualslot
void sofa::gui::qt::RealGUI::setDumpState ( bool  b)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setExportGnuplot ( bool  exp)
virtualslot
void sofa::gui::qt::RealGUI::setExportState ( bool  b)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setExportVisitor ( bool  )
virtualslot
void sofa::gui::qt::RealGUI::setFullScreen ( )
inlineoverridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setFullScreen ( bool  enable)
virtual
void sofa::gui::qt::RealGUI::setGnuplotPath ( const std::string &  path)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setLogTime ( bool  b)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setMouseButtonConfiguration ( sofa::component::configurationsetting::MouseButtonSetting button)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::SetPixmap ( std::string  pixmap_filename,
QPushButton b 
)
static
void sofa::gui::qt::RealGUI::setRecordPath ( const std::string &  path)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setScene ( Node::SPtr  groot,
const char *  filename = nullptr,
bool  temporaryFile = false 
)
overridevirtual

Register the scene in our GUI.

Implements sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setSceneWithoutMonitor ( Node::SPtr  groot,
const char *  filename = nullptr,
bool  temporaryFile = false 
)
virtual
virtual void sofa::gui::qt::RealGUI::setSizeH ( int  _valH)
inlinevirtualslot
virtual void sofa::gui::qt::RealGUI::setSizeW ( int  _valW)
inlinevirtualslot
void sofa::gui::qt::RealGUI::setSleepingNode ( sofa::simulation::Node node,
bool  sleeping 
)
virtualslot
void sofa::gui::qt::RealGUI::setTitle ( std::string  windowTitle)
virtual
void sofa::gui::qt::RealGUI::setViewerConfiguration ( sofa::component::configurationsetting::ViewerSetting viewerConf)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::setViewerResolution ( int  w,
int  h 
)
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::showDocBrowser ( )
virtualslot
void sofa::gui::qt::RealGUI::showFPS ( double  )
overridevirtual

Force the displayed FPS value (if any)

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::showhideElements ( )
virtualslot
void sofa::gui::qt::RealGUI::showMouseManager ( )
virtualslot
void sofa::gui::qt::RealGUI::showPluginManager ( )
virtualslot
void sofa::gui::qt::RealGUI::showVideoRecorderManager ( )
virtualslot
void sofa::gui::qt::RealGUI::showWindowDataGraph ( )
virtualslot
void sofa::gui::qt::RealGUI::sleep ( float  seconds,
float  init_time 
)
inlineprotected
void sofa::gui::qt::RealGUI::startDumpVisitor ( )
protected
void sofa::gui::qt::RealGUI::step ( )
virtualslot
void sofa::gui::qt::RealGUI::stepMainLoop ( )
overridevirtual

Reimplemented from sofa::gui::BaseGUI.

void sofa::gui::qt::RealGUI::stopDumpVisitor ( )
protected
void sofa::gui::qt::RealGUI::toolsDockMoved ( )
virtualslot
void sofa::gui::qt::RealGUI::unloadScene ( bool  _withViewer = true)
virtual
void sofa::gui::qt::RealGUI::Update ( )
virtualslot
void sofa::gui::qt::RealGUI::updateBackgroundColour ( )
virtualslot
void sofa::gui::qt::RealGUI::updateBackgroundImage ( )
virtualslot
void sofa::gui::qt::RealGUI::updateDtEditState ( )
virtualslot
void sofa::gui::qt::RealGUI::updateViewerList ( )
protectedvirtualslot

Update the viewerMap and create viewer if we haven't yet one (the first of the list) TODO: find a better way to propagate the argument when we construct the viewer