BaseGUI
The `BaseGUI` class in SOFA (Simulation Open-Framework Architecture) serves as the foundation for implementing graphical user interfaces (GUIs). It provides an interface and basic functionalities that any GUI implementation must support or extend. ### Key Features: - **Initialization**: The constructor initializes the GUI, while the destructor ensures proper cleanup through the `closeGUI()` method. - **Configuration Management**: It includes methods to configure different aspects of the GUI such as viewers, background settings, and mouse button configurations. These are primarily set via components within the simulation tree (`sofa::simulation::Node`). - **Screen Capture**: The `saveScreenshot` function allows capturing screenshots from a viewer. - **Gnuplot Export**: It offers functionality to export Gnuplot data for external visualization or analysis. ### Methods: - **setDumpTime**, **setLogTime**, **setExportState**, and other methods control the logging and exporting of simulation state information, aiding in debugging and performance monitoring. - **getViewer** returns a pointer to the viewer associated with the GUI. The `registerViewer` method registers new viewers with the GUI. - **canBeDefaultGUI**: This function determines if this particular GUI implementation should be considered as a default option when no specific GUI is specified by the user during initialization. ### Static Members: - **GetGUIName**, **GetProgramName**, and related methods handle naming conventions for GUI implementations and associated program names. These are useful for identifying which GUI variant is currently active or has been selected by the user. - **setConfigDirectoryPath** and **getScreenshotDirectoryPath**: These allow setting and retrieving paths where configuration files and screenshot images should be saved, respectively. The `setDirectoryPath` utility function checks if a given path exists and creates it if necessary. ### Usage: The class serves as an abstract base that must be extended by concrete GUI implementations (such as QTGUI). It enforces a consistent interface for SOFA applications to interact with various GUI options, ensuring interoperability across different user interfaces while hiding the specific implementation details from the core simulation engine.
- abstract
- `BaseGUI` provides an abstract interface for implementing graphical user interfaces in SOFA, managing viewer configurations, background settings, and mouse interactions.
- sheet
- # BaseGUI ## Overview The `BaseGUI` class serves as the foundation for implementing graphical user interfaces (GUIs) within the SOFA framework. It defines methods to configure viewers, manage background settings, handle mouse button configurations, and save screenshots. ## Parameters and Data - **Viewer Configuration**: Methods like `setViewerConfiguration`, `setBackgroundColor`, and `setBackgroundImage` control viewer properties such as dimensions, resolution, and background appearance. - **Mouse Button Settings**: The `setMouseButtonConfiguration` method configures mouse interactions using a `sofa::component::setting::MouseButtonSetting` component. - **Logging and Exporting**: Methods like `setDumpState`, `setLogTime`, and `setExportState` manage logging and exporting of simulation state information. - **Directory Paths**: Static methods such as `getConfigDirectoryPath` and `getScreenshotDirectoryPath` handle the paths for configuration files and screenshot images, respectively.
- description
- The `BaseGUI` class in SOFA (Simulation Open-Framework Architecture) serves as the foundation for implementing graphical user interfaces (GUIs). It provides an interface and basic functionalities that any GUI implementation must support or extend. ### Key Features: - **Initialization**: The constructor initializes the GUI, while the destructor ensures proper cleanup through the `closeGUI()` method. - **Configuration Management**: It includes methods to configure different aspects of the GUI such as viewers, background settings, and mouse button configurations. These are primarily set via components within the simulation tree (`sofa::simulation::Node`). - **Screen Capture**: The `saveScreenshot` function allows capturing screenshots from a viewer. - **Gnuplot Export**: It offers functionality to export Gnuplot data for external visualization or analysis. ### Methods: - **setDumpTime**, **setLogTime**, **setExportState**, and other methods control the logging and exporting of simulation state information, aiding in debugging and performance monitoring. - **getViewer** returns a pointer to the viewer associated with the GUI. The `registerViewer` method registers new viewers with the GUI. - **canBeDefaultGUI**: This function determines if this particular GUI implementation should be considered as a default option when no specific GUI is specified by the user during initialization. ### Static Members: - **GetGUIName**, **GetProgramName**, and related methods handle naming conventions for GUI implementations and associated program names. These are useful for identifying which GUI variant is currently active or has been selected by the user. - **setConfigDirectoryPath** and **getScreenshotDirectoryPath**: These allow setting and retrieving paths where configuration files and screenshot images should be saved, respectively. The `setDirectoryPath` utility function checks if a given path exists and creates it if necessary. ### Usage: The class serves as an abstract base that must be extended by concrete GUI implementations (such as QTGUI). It enforces a consistent interface for SOFA applications to interact with various GUI options, ensuring interoperability across different user interfaces while hiding the specific implementation details from the core simulation engine.
- summary
- The `BaseGUI` class in SOFA provides foundational functionalities and an interface template for creating graphical user interfaces. It supports configuration management, screen capture, Gnuplot export, and other utilities needed by GUI implementations.
- maths
- The `BaseGUI` class in the SOFA framework serves as an abstract base for implementing various graphical user interfaces (GUIs) that can be used to visualize and interact with simulations. This class is not directly involved in mathematical computations but provides a framework for integrating different GUI functionalities within the simulation environment. Below, we break down its key components from both mathematical and physical perspectives: ### 1. Configuration Management Methods - **Viewer Settings**: The `setViewerConfiguration` method allows setting up properties related to the viewer (like dimensions) using settings defined in a `sofa::component::setting::ViewerSetting` component. - **Mathematical Representation**: \[ ext{viewerConfig} = \left\{egin{array}{ll} \text{width}, & \text{height}, & \text{resolution}, & \ldots \end{array}\right\} \] - **Background Settings**: The background color and image settings are configured using a `sofa::component::setting::BackgroundSetting` component. - **Mathematical Representation**: \[ ext{backgroundConfig} = \left\{egin{array}{ll} \text{color}, & \text{imagePath} \end{array}\right\} \] - **Stats Settings**: Various simulation statistics such as dumping state, logging time, exporting states, and tracing visitor information are managed using the `sofa::component::setting::StatsSetting` component. - **Mathematical Representation**: \[ ext{statsConfig} = \left\{egin{array}{ll} \text{dumpState}, & \text{logTime}, & \text{exportState}, & \text{traceVisitors} \end{array}\right\} \] - **Mouse Button Settings**: Mouse interactions are configured using the `sofa::component::setting::MouseButtonSetting` components. - **Mathematical Representation**: \[ ext{mouseConfig} = \left\{egin{array}{ll} \text{button}, & \text{action}, & \ldots \end{array}\right\} \] ### 2. Saving Screenshots The `saveScreenshot` method captures an image from the viewer and saves it to a specified file path. - **Mathematical Representation**: - The process involves rendering the current state of the simulation onto a framebuffer, which is then saved as an image file (e.g., PNG, JPEG). \[ ext{imageFile} = \text{screenshot}() \] ### 3. Gnuplot Export The `exportGnuplot` method exports data to Gnuplot format for external plotting and analysis. - **Mathematical Representation**: - The export process involves extracting relevant simulation state information (e.g., time, forces) and formatting it into a text file that can be read by Gnuplot. \[ ext{exportGnuplot} = \left\{egin{array}{ll} \text{time}, & \text{forces}, & \ldots \end{array}\right\} \] ### 4. Directory Path Management Methods such as `setConfigDirectoryPath` and `getScreenshotDirectoryPath` manage the directories where configuration files and screenshots are saved, respectively. - **Mathematical Representation**: - These methods ensure that paths are valid and can be created if necessary. \[ ext{directoryPath} = \left\{egin{array}{ll} \text{configDirectory}, & \text{screenshotDirectory} \end{array}\right\} \] ### Summary The `BaseGUI` class provides a structured framework for integrating various GUI functionalities into the SOFA simulation environment. It ensures that all necessary configurations and interactions can be managed consistently, allowing developers to focus on implementing specific GUI behaviors without worrying about low-level details.
{
"name": "BaseGUI",
"main": {
"name": "BaseGUI",
"namespace": "sofa::gui::common",
"module": "Sofa.GUI.Common",
"include": "sofa/gui/common/BaseGUI.h",
"doc": "",
"inherits": [],
"templates": [],
"data_fields": [],
"links": [],
"methods": [
{
"name": "mainLoop",
"return_type": "int",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "redraw",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "closeGUI",
"return_type": "int",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "setScene",
"return_type": "void",
"params": [
{
"name": "groot",
"type": "sofa::simulation::NodeSPtr"
},
{
"name": "filename",
"type": "const char *"
},
{
"name": "temporaryFile",
"type": "bool"
}
],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "currentSimulation",
"return_type": "sofa::simulation::Node *",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "configureGUI",
"return_type": "void",
"params": [
{
"name": "groot",
"type": "sofa::simulation::NodeSPtr"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setDumpState",
"return_type": "void",
"params": [
{
"name": "",
"type": "bool"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setLogTime",
"return_type": "void",
"params": [
{
"name": "",
"type": "bool"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setExportState",
"return_type": "void",
"params": [
{
"name": "",
"type": "bool"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setGnuplotPath",
"return_type": "void",
"params": [
{
"name": "",
"type": "const int &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "initViewer",
"return_type": "void",
"params": [
{
"name": "",
"type": "BaseViewer *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setViewerConfiguration",
"return_type": "void",
"params": [
{
"name": "",
"type": "sofa::component::setting::ViewerSetting *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setViewerResolution",
"return_type": "void",
"params": [
{
"name": "",
"type": "int"
},
{
"name": "",
"type": "int"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setFullScreen",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "centerWindow",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setBackgroundColor",
"return_type": "void",
"params": [
{
"name": "",
"type": "const sofa::type::RGBAColor &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setBackgroundImage",
"return_type": "void",
"params": [
{
"name": "",
"type": "const int &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getViewer",
"return_type": "BaseViewer *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "registerViewer",
"return_type": "void",
"params": [
{
"name": "",
"type": "BaseViewer *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "saveScreenshot",
"return_type": "bool",
"params": [
{
"name": "filename",
"type": "const int &"
},
{
"name": "compression_level",
"type": "int"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setMouseButtonConfiguration",
"return_type": "void",
"params": [
{
"name": "",
"type": "sofa::component::setting::MouseButtonSetting *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "stepMainLoop",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "sendMessage",
"return_type": "void",
"params": [
{
"name": "",
"type": "const int &"
},
{
"name": "",
"type": "const int &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "showFPS",
"return_type": "void",
"params": [
{
"name": "",
"type": "double"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "exportGnuplot",
"return_type": "void",
"params": [
{
"name": "node",
"type": "sofa::simulation::Node *"
},
{
"name": "gnuplot_directory",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "GetGUIName",
"return_type": "int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "GetProgramName",
"return_type": "const char *",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "SetProgramName",
"return_type": "void",
"params": [
{
"name": "argv0",
"type": "const char *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "SetArgumentParser",
"return_type": "void",
"params": [
{
"name": "parser",
"type": "ArgumentParser *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "getConfigDirectoryPath",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "getScreenshotDirectoryPath",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "setConfigDirectoryPath",
"return_type": "void",
"params": [
{
"name": "path",
"type": "const int &"
},
{
"name": "createIfNecessary",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "setScreenshotDirectoryPath",
"return_type": "void",
"params": [
{
"name": "path",
"type": "const int &"
},
{
"name": "createIfNecessary",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "canBeDefaultGUI",
"return_type": "bool",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
]
},
"desc": {
"description": "The `BaseGUI` class in SOFA (Simulation Open-Framework Architecture) serves as the foundation for implementing graphical user interfaces (GUIs). It provides an interface and basic functionalities that any GUI implementation must support or extend.\n\n### Key Features:\n- **Initialization**: The constructor initializes the GUI, while the destructor ensures proper cleanup through the `closeGUI()` method.\n- **Configuration Management**: It includes methods to configure different aspects of the GUI such as viewers, background settings, and mouse button configurations. These are primarily set via components within the simulation tree (`sofa::simulation::Node`).\n- **Screen Capture**: The `saveScreenshot` function allows capturing screenshots from a viewer.\n- **Gnuplot Export**: It offers functionality to export Gnuplot data for external visualization or analysis.\n\n### Methods:\n- **setDumpTime**, **setLogTime**, **setExportState**, and other methods control the logging and exporting of simulation state information, aiding in debugging and performance monitoring.\n- **getViewer** returns a pointer to the viewer associated with the GUI. The `registerViewer` method registers new viewers with the GUI.\n- **canBeDefaultGUI**: This function determines if this particular GUI implementation should be considered as a default option when no specific GUI is specified by the user during initialization.\n\n### Static Members:\n- **GetGUIName**, **GetProgramName**, and related methods handle naming conventions for GUI implementations and associated program names. These are useful for identifying which GUI variant is currently active or has been selected by the user.\n- **setConfigDirectoryPath** and **getScreenshotDirectoryPath**: These allow setting and retrieving paths where configuration files and screenshot images should be saved, respectively. The `setDirectoryPath` utility function checks if a given path exists and creates it if necessary.\n\n### Usage:\nThe class serves as an abstract base that must be extended by concrete GUI implementations (such as QTGUI). It enforces a consistent interface for SOFA applications to interact with various GUI options, ensuring interoperability across different user interfaces while hiding the specific implementation details from the core simulation engine.",
"summary": "The `BaseGUI` class in SOFA provides foundational functionalities and an interface template for creating graphical user interfaces. It supports configuration management, screen capture, Gnuplot export, and other utilities needed by GUI implementations."
},
"maths": {
"maths": "The `BaseGUI` class in the SOFA framework serves as an abstract base for implementing various graphical user interfaces (GUIs) that can be used to visualize and interact with simulations. This class is not directly involved in mathematical computations but provides a framework for integrating different GUI functionalities within the simulation environment. Below, we break down its key components from both mathematical and physical perspectives:\n\n### 1. Configuration Management Methods\n\n- **Viewer Settings**: The `setViewerConfiguration` method allows setting up properties related to the viewer (like dimensions) using settings defined in a `sofa::component::setting::ViewerSetting` component.\n - **Mathematical Representation**:\n \\[ \text{viewerConfig} = \\left\\{\begin{array}{ll}\n \\text{width}, &\n \\text{height}, &\n \\text{resolution}, &\n \\ldots\n \\end{array}\\right\\}\n \\]\n- **Background Settings**: The background color and image settings are configured using a `sofa::component::setting::BackgroundSetting` component.\n - **Mathematical Representation**:\n \\[ \text{backgroundConfig} = \\left\\{\begin{array}{ll}\n \\text{color}, &\n \\text{imagePath}\n \\end{array}\\right\\}\n \\]\n- **Stats Settings**: Various simulation statistics such as dumping state, logging time, exporting states, and tracing visitor information are managed using the `sofa::component::setting::StatsSetting` component.\n - **Mathematical Representation**:\n \\[ \text{statsConfig} = \\left\\{\begin{array}{ll}\n \\text{dumpState}, &\n \\text{logTime}, &\n \\text{exportState}, &\n \\text{traceVisitors}\n \\end{array}\\right\\}\n \\]\n- **Mouse Button Settings**: Mouse interactions are configured using the `sofa::component::setting::MouseButtonSetting` components.\n - **Mathematical Representation**:\n \\[ \text{mouseConfig} = \\left\\{\begin{array}{ll}\n \\text{button}, &\n \\text{action}, &\n \\ldots\n \\end{array}\\right\\}\n \\]\n\n### 2. Saving Screenshots\nThe `saveScreenshot` method captures an image from the viewer and saves it to a specified file path.\n- **Mathematical Representation**:\n - The process involves rendering the current state of the simulation onto a framebuffer, which is then saved as an image file (e.g., PNG, JPEG).\n \\[ \text{imageFile} = \\text{screenshot}() \\]\n\n### 3. Gnuplot Export\nThe `exportGnuplot` method exports data to Gnuplot format for external plotting and analysis.\n- **Mathematical Representation**:\n - The export process involves extracting relevant simulation state information (e.g., time, forces) and formatting it into a text file that can be read by Gnuplot.\n \\[ \text{exportGnuplot} = \\left\\{\begin{array}{ll}\n \\text{time}, &\n \\text{forces}, &\n \\ldots\n \\end{array}\\right\\}\n \\]\n\n### 4. Directory Path Management\nMethods such as `setConfigDirectoryPath` and `getScreenshotDirectoryPath` manage the directories where configuration files and screenshots are saved, respectively.\n- **Mathematical Representation**:\n - These methods ensure that paths are valid and can be created if necessary.\n \\[ \text{directoryPath} = \\left\\{\begin{array}{ll}\n \\text{configDirectory}, &\n \\text{screenshotDirectory}\n \\end{array}\\right\\}\n \\]\n\n### Summary\nThe `BaseGUI` class provides a structured framework for integrating various GUI functionalities into the SOFA simulation environment. It ensures that all necessary configurations and interactions can be managed consistently, allowing developers to focus on implementing specific GUI behaviors without worrying about low-level details."
},
"summary": {
"abstract": "`BaseGUI` provides an abstract interface for implementing graphical user interfaces in SOFA, managing viewer configurations, background settings, and mouse interactions.",
"sheet": "# BaseGUI\n\n## Overview\nThe `BaseGUI` class serves as the foundation for implementing graphical user interfaces (GUIs) within the SOFA framework. It defines methods to configure viewers, manage background settings, handle mouse button configurations, and save screenshots.\n\n## Parameters and Data\n- **Viewer Configuration**: Methods like `setViewerConfiguration`, `setBackgroundColor`, and `setBackgroundImage` control viewer properties such as dimensions, resolution, and background appearance.\n- **Mouse Button Settings**: The `setMouseButtonConfiguration` method configures mouse interactions using a `sofa::component::setting::MouseButtonSetting` component.\n- **Logging and Exporting**: Methods like `setDumpState`, `setLogTime`, and `setExportState` manage logging and exporting of simulation state information.\n- **Directory Paths**: Static methods such as `getConfigDirectoryPath` and `getScreenshotDirectoryPath` handle the paths for configuration files and screenshot images, respectively."
}
}