1 .. _fields_arch_gui_page:
7 FIELDS module uses the following components to manage and display presentations:
9 * Standard SALOME *Object browser* represents structure of MED file within FIELDS module. When MED file is loaded, the following steps are performed:
11 #. Reading structure of MED file. For these purpose, ``MEDCALC::MedDataManager`` CORBA service (which uses *MEDCoupling* library) is used.
12 #. Creating structure of MED file (full path to MED file, name of a mesh, name and type (``ON_NODES`` or ``ON_CELLS``) of each field in MED file, and all timesteps for each field).
13 ``MED_ORB::MED`` CORBA component is used for that, and each item of the data tree structure is represented via standard SALOME data object ``SObject``.
15 * *Presentation Parameters* panel allows managing parameters of presentations. This panel is implemented in the following way:
17 #. Interface of *Presentation Parameters* panel is described via `Qt Designer tool <https://doc.qt.io/qt-5/qtdesigner-manual.html>`__;
18 for details see ``WidgetPresentationParameters.ui`` (UI form) and ``WidgetPresentationParameters.cxx`` (C++ wrapping of UI) files.
19 The UI file contains all needed GUI controls which are used to manage parameters of all FIELDS presentations, i.e. single UI file is used for all types of presentations.
20 All these parameters are hidden by default; and parameters, required for specific presentation are shown at first usage, for example:
24 void WidgetPresentationParameters::setSliceOrientation(MEDCALC::SliceOrientationType orient) {
27 _ui.labelSliceOrient->show();
28 _ui.comboBoxSliceOrient->show();
34 Widget which contains all these parameters is displayed inside the dockable window which is created during the initialization of FIELDS module.
36 #. Interaction between GUI controls and ``medcalc`` Python package is implemented via several helper classes. The hierarchy of these classes is presented on the following diagram:
38 .. image:: images/image_helpers_hierarchy.png
41 * ``MEDWidgetHelper`` - base abstract class to manage common parameters of all FIELDS presentations.
42 * ``MEDWidgetHelperComponent`` - base abstract class to manage parameters of all presentations having only one component to change.
44 These base classes contain one pure virtual method
48 virtual std::string getPythonTag() const = 0;
50 This method must be implemented in all descendant classes; it should return the type of a presentation ("ScalarMap", "Slices" and etc.)
52 * All other classes (such as ``MEDWidgetHelperScalarMap``, ``MEDWidgetHelperSlices`` etc.) are descendants of classes ``MEDWidgetHelper`` or ``MEDWidgetHelperComponent``.
54 Helper classes send ``PresentationEvent`` event via emitting ``presentationUpdateSignal`` signal on any user action made in *Presentation Parameters* panel.
56 #. ``PresentationController`` class is aimed for
58 * Converting ``PresentationEvent`` events to calls of ``medcalc`` Python package API, and executing related commands in the embedded Python console, for example:
64 if ( event->eventtype == PresentationEvent::EVENT_CHANGE_COMPONENT ) {
66 // Get presentation type by calling getPythonTag() method
67 std::string typ = getPresTypeFromWidgetHelper(event->presentationId);
69 // Convert 'PresentationEvent' to set of python commands
70 commands += QString("params = medcalc.Get%1Parameters(%2)").arg(QString::fromStdString(typ)).arg(event->presentationId);
71 commands += QString("params.displayedComponent = '%1'").arg(QString::fromStdString(event->aString));
72 commands += QString("medcalc.Update%1(%2, params)").arg(QString::fromStdString(typ)).arg(event->presentationId);
75 _consoleDriver->exec(commands);
77 * Updating content of *Presentation Parameters* panel according to the presentation, selected in the *Object browser*.
79 * Standard SALOME *Displayer* mechanism is used to manage visiblity of FIELDS presentations in the ParaView viewer.