Salome HOME
6abc79f35d4e8c3976564711bef9a2fbcc09ace4
[modules/med.git] / src / MEDOP / gui / DatasourceController.hxx
1 // Copyright (C) 2007-2013  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.
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 "MEDOPGUI.hxx"
35 //
36 // The DatasourceController defines data structures and classes to
37 // manage the usage of objects in the data space. The data space is
38 // technically the study, whose graphical representation is the
39 // objects browser.
40 //
41
42 // A datasource event is used by the DatasourceController to notify a
43 // job to the Workspace controller (Qt signal/slot pattern connected
44 // by the main controller MEDOPModule). The setting of attributes and
45 // usage of these attributes in the WorkspaceController depends on the
46 // event type. For example, in the case of a IMPORT event, we just
47 // have to transmit the object, while in the USE event we have to
48 // transmit an object AND an alias.
49 typedef struct {
50   enum EventType {
51     // 
52     EVENT_IMPORT_OBJECT, // Simply import the object in the workspace
53     EVENT_USE_OBJECT,    // Import in the workspace AND define a proxy
54                          // variable in the tui console to use it
55     EVENT_VIEW_OBJECT    // View with a salome viewer (SMESH/VISU/PARAVIS)
56   };
57   int eventtype;
58   XmedDataObject * objectdata;
59   QString objectalias;
60 } DatasourceEvent;
61
62 //
63 // ==============================================================
64 // Datasource controller
65 // ==============================================================
66 //
67 class MEDOPGUI_EXPORT DatasourceController: public QObject {
68   Q_OBJECT
69
70 public:
71   DatasourceController(StandardApp_Module * salomeModule);
72   ~DatasourceController();
73
74   void createActions();
75   MEDOP::DatasourceHandler * addDatasource(const char * filename);
76
77 public slots:
78   // Callback connected to dialog box validation signals
79   void OnChangeUnderlyingMeshInputValidated();
80
81 signals:
82   void datasourceSignal(const DatasourceEvent * event);
83
84 protected slots:
85   void OnAddDatasource();
86   void OnAddImagesource();
87   void OnExpandField();
88   void OnVisualize();
89   void OnUseInWorkspace();
90   void OnChangeUnderlyingMesh();
91
92
93 private:
94   StandardApp_Module * _salomeModule;
95   SALOME_AppStudyEditor * _studyEditor;
96
97   DlgChangeUnderlyingMesh * _dlgChangeUnderlyingMesh;
98
99 };
100
101 #endif