Salome HOME
#28928 [CEA] FIELDS : developer documentation for the simplified visualisation
[modules/med.git] / doc / dev / sphinx / fields_arch_plot3d_implementation_example.rst
1 .. _fields_arch_plot3d_implementation_example_page:
2
3 *******************************************
4 Implementation example: Plot3D presentation
5 *******************************************
6
7 This section describes how a FIELDS presentation is implemented using Plot3D presentation as an example.
8
9 General description of Plot3D presentation
10 ------------------------------------------
11
12 Plot3D is a presentation of scalar values of meshes lying on a cutting plane.
13 The relief and coloring of the resulting presentation both correspond to the values applied to the cells of a mesh.
14
15 In general this presentation can be built using the following sequence of the ParaVis filters:
16
17 **MedReadear** -> **Slice** -> **Calculator** -> **WarpByScalar**
18
19 * **MedReadear** is used to read a MED file.
20
21 * **Slice** filter defines a cutting plane within the 3D mesh, on the basis of which the relief presentation is built. 
22   This plane is a 2D mesh with values (scalar or vector) applied to the cells of a plane. If initial mesh is a 2D mesh, then **Slice** filter is unnecessary.
23
24 * **Calculator** filter converts vector values on cells to the scalar values. In case of scalar values **Calculator** filter is unnecessary.
25
26 * Finally, **WarpByScalar** filter is applied to the 2D mesh with scalar values on cells to build colored relief presentation.
27
28 Currently, only two parameters can be changed for this type of presentation, namely:
29
30 * *Position of a cutting plane* allows selecting the position of the cutting plane within the bounding box of a mesh (ranging from 0 to 1). This it is a property of **Slice** filter.
31 * *Cutting plane normal* allows specifying an orientation of the cut plane in 3D space. This is also a property of **Slice** filter. 
32
33 All other parameters are inherited from the parent presentation class.
34
35 GUI controls
36 ------------
37
38 First step consists in implementing the corresponging GUI controls. This step includes the following actions:
39
40 * Add needed controls to UI using Qt *Designer*
41
42   .. image:: images/image_ui_designer_prs_panel.png
43      :align: center
44
45 * Implement C++ wrappings for newly created GUI controls and add corresponding signal-slot connections: see :ref:`code <fields_arch_widget_presentation_parameters_page>`.
46
47 * Add new types of events into :ref:`PresentationEvent.hxx<fields_arch_presentation_event_page>` file:
48
49    .. code-block:: cpp
50
51       ... 
52       EVENT_VIEW_OBJECT_PLOT3D,
53       ...
54       EVENT_CHANGE_NORMAL,
55       EVENT_CHANGE_PLANE_POS,
56
57 * Implement :ref:`MEDWidgetHelperPlot3D<fields_arch_medwidget_helper_plot3d_page>` class. This class sends events to ``PresentationController`` on each user action in the *Presentation Parameters*
58   panel and updates a content of the *Presentation Parameters* panel in case if changes in a presentation were made, via the ``medcalc`` Python API.
59
60 * Modify ``PresentationController`` class. This class is used to add items into the *Presentations* menu and toolbar, and to translate GUI events into the ``medcalc`` Python API: see :ref:`code<fields_arch_presentation_controller_page>`.
61
62 Extend ``MEDCALC::MEDPresentationManager``
63 ------------------------------------------
64
65 Next step consists in extending of the ``MEDCALC::MEDPresentationManager`` CORBA service; it assumes the following actions:
66
67 * :ref:`Extend<fields_arch_med_presentation_manager_page>` ``MEDPresentationManager`` IDL interface.
68
69 * :ref:`Implement<fields_arch_med_presentation_manager_impl_page>` methods, declared in the IDL interface.
70
71 Extend ``medcalc`` API
72 ----------------------
73
74 Next step consists in :ref:`extending<fields_arch_med_presentation_py_page>` ``medcalc`` Python API, by adding functions to make and update Plot3D presentation and retrieve parameters of Plot3D presentations.
75
76 Implement pipeline
77 ------------------
78
79 Final step consists in building the pipeline, described above, in the frames of the ``MEDPresentationPlot3D`` :ref:`class<fields_arch_med_presentation_plot3d_page>`.