Salome HOME
Copyrights update 2015.
[modules/med.git] / src / MEDOP / gui / DatasourceController.hxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // Author : Guillaume Boulant (EDF)
21
22 #ifndef DATASOURCE_CONTROLLER_H
23 #define DATASOURCE_CONTROLLER_H
24
25 #include <SALOMEconfig.h>
26 #include CORBA_CLIENT_HEADER(MEDDataManager)
27 #include <StandardApp_Module.hxx>
28 #include <SALOME_AppStudyEditor.hxx>
29
30 #include <map>
31
32 #include "XmedDataModel.hxx"
33 #include "DlgChangeUnderlyingMesh.hxx"
34 #include "DlgInterpolateField.hxx"
35 #include "MEDOPGUI.hxx"
36 //
37 // The DatasourceController defines data structures and classes to
38 // manage the usage of objects in the data space. The data space is
39 // technically the study, whose graphical representation is the
40 // objects browser.
41 //
42
43 // A datasource event is used by the DatasourceController to notify a
44 // job to the Workspace controller (Qt signal/slot pattern connected
45 // by the main controller MEDOPModule). The setting of attributes and
46 // usage of these attributes in the WorkspaceController depends on the
47 // event type. For example, in the case of a IMPORT event, we just
48 // have to transmit the object, while in the USE event we have to
49 // transmit an object AND an alias.
50 typedef struct {
51   enum EventType {
52     //
53     EVENT_IMPORT_OBJECT, // Simply import the object in the workspace
54     EVENT_USE_OBJECT,    // Import in the workspace AND define a proxy
55                          // variable in the tui console to use it
56     EVENT_VIEW_OBJECT    // View with a salome viewer (SMESH/VISU/PARAVIS)
57   };
58   int eventtype;
59   XmedDataObject * objectdata;
60   QString objectalias;
61 } DatasourceEvent;
62
63 //
64 // ==============================================================
65 // Datasource controller
66 // ==============================================================
67 //
68 class MEDOPGUI_EXPORT DatasourceController: public QObject {
69   Q_OBJECT
70
71 public:
72   DatasourceController(StandardApp_Module * salomeModule);
73   ~DatasourceController();
74
75   void createActions();
76   MEDOP::DatasourceHandler * addDatasource(const char * filename);
77
78 public slots:
79   // Callback connected to dialog box validation signals
80   void OnChangeUnderlyingMeshInputValidated();
81   void OnInterpolateFieldInputValidated();
82
83 signals:
84   void datasourceSignal(const DatasourceEvent * event);
85
86 protected slots:
87   void OnAddDatasource();
88   void OnAddImagesource();
89   void OnExpandField();
90   void OnVisualize();
91   void OnUseInWorkspace();
92   void OnChangeUnderlyingMesh();
93   void OnInterpolateField();
94
95
96 private:
97   StandardApp_Module * _salomeModule;
98   SALOME_AppStudyEditor * _studyEditor;
99
100   DlgChangeUnderlyingMesh * _dlgChangeUnderlyingMesh;
101   DlgInterpolateField * _dlgInterpolateField;
102
103 };
104
105 #endif