Salome HOME
Merge from V6_main (04/10/2012)
[modules/med.git] / src / MEDOP / gui / DatasourceController.hxx
1
2 // Author : Guillaume Boulant (EDF) 
3
4 #ifndef DATASOURCE_CONTROLLER_H
5 #define DATASOURCE_CONTROLLER_H
6
7 #include <SALOMEconfig.h>
8 #include CORBA_CLIENT_HEADER(MEDDataManager)
9 #include <StandardApp_Module.hxx>
10 #include <SALOME_AppStudyEditor.hxx>
11
12 #include <map>
13
14 #include "XmedDataModel.hxx"
15 #include "DlgChangeUnderlyingMesh.hxx"
16 #include "MEDOPGUI.hxx"
17 //
18 // The DatasourceController defines data structures and classes to
19 // manage the usage of objects in the data space. The data space is
20 // technically the study, whose graphical representation is the
21 // objects browser.
22 //
23
24 // A datasource event is used by the DatasourceController to notify a
25 // job to the Workspace controller (Qt signal/slot pattern connected
26 // by the main controller MEDOPModule). The setting of attributes and
27 // usage of these attributes in the WorkspaceController depends on the
28 // event type. For example, in the case of a IMPORT event, we just
29 // have to transmit the object, while in the USE event we have to
30 // transmit an object AND an alias.
31 typedef struct {
32   enum EventType {
33     // 
34     EVENT_IMPORT_OBJECT, // Simply import the object in the workspace
35     EVENT_USE_OBJECT,    // Import in the workspace AND define a proxy
36                          // variable in the tui console to use it
37     EVENT_VIEW_OBJECT    // View with a salome viewer (SMESH/VISU/PARAVIS)
38   };
39   int eventtype;
40   XmedDataObject * objectdata;
41   QString objectalias;
42 } DatasourceEvent;
43
44 //
45 // ==============================================================
46 // Datasource controller
47 // ==============================================================
48 //
49 class MEDOPGUI_EXPORT DatasourceController: public QObject {
50   Q_OBJECT
51
52 public:
53   DatasourceController(StandardApp_Module * salomeModule);
54   ~DatasourceController();
55
56   void createActions();
57   MEDOP::DatasourceHandler * addDatasource(const char * filename);
58
59 public slots:
60   // Callback connected to dialog box validation signals
61   void OnChangeUnderlyingMeshInputValidated();
62
63 signals:
64   void datasourceSignal(const DatasourceEvent * event);
65
66 protected slots:
67   void OnAddDatasource();
68   void OnAddImagesource();
69   void OnExpandField();
70   void OnVisualize();
71   void OnUseInWorkspace();
72   void OnChangeUnderlyingMesh();
73
74
75 private:
76   StandardApp_Module * _salomeModule;
77   SALOME_AppStudyEditor * _studyEditor;
78
79   DlgChangeUnderlyingMesh * _dlgChangeUnderlyingMesh;
80
81 };
82
83 #endif