Salome HOME
6fccaf9a0791764dcde3b0f9486f946cb3c274f5
[modules/multipr.git] / src / MULTIPRGUI / MULTIPR_GUI.h
1 // Project MULTIPR, IOLS WP1.2.1 - EDF/CS
2 // Partitioning/decimation module for the SALOME v3.2 platform
3
4 /**
5  * \file    MULTIPR_GUI.h
6  *
7  * \brief   MULTIPR GUI (QT)
8  *
9  * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
10  * 
11  * \date    01/2007
12  */
13
14 #ifndef __MULTIPR_GUI__
15 #define __MULTIPR_GUI__
16
17
18 //*****************************************************************************
19 // Includes section
20 //*****************************************************************************
21
22 #include <SalomeApp_Module.h>
23 #include <LightApp_DataObject.h>
24 //#include <LightApp_DataModel.h>
25 #include <SalomeApp_DataModel.h>
26
27 #include <SALOMEconfig.h>
28 #include CORBA_CLIENT_HEADER(MULTIPR)
29
30 #include "MULTIPR_ProgressCallback.hxx"
31
32
33 //*****************************************************************************
34 // Pre-declaration
35 //*****************************************************************************
36
37 class SalomeApp_Application;
38 class CAM_Module;
39
40 class QVBoxLayout;
41 class QHBoxLayout;
42 class QGridLayout;
43 class QSpacerItem;
44 class QButtonGroup;
45 class QLabel;
46 class QComboBox;
47 class QLineEdit;
48 class QSpinBox;
49 class QPushButton;
50
51 class QTimer;
52 //class MULTIPR_GUI_ProgressCallbackDlg;
53 class QProgressDialog;
54
55 //*****************************************************************************
56 // Class MULTIPR_GUI
57 // Salome Application
58 //*****************************************************************************
59
60 class MULTIPR_GUI: public SalomeApp_Module
61 {
62     Q_OBJECT
63
64 public:
65
66     MULTIPR_GUI();
67     
68     virtual ~MULTIPR_GUI();
69     
70     void initialize(CAM_Application*);
71     
72     QString engineIOR() const;
73     
74     void windows(QMap<int, int>&) const;
75     
76     MULTIPR_ORB::MULTIPR_Obj_ptr getMULTIPRObj();
77     void setMULTIPRObj (MULTIPR_ORB::MULTIPR_Obj_ptr theObj);
78     
79     SalomeApp_Application* getAppli() const;
80     
81     void selected(QStringList&, const bool);
82     
83     const QStringList& getSelectedParts() const { return mSelectedParts; }
84
85 public slots:
86
87     bool deactivateModule(SUIT_Study*);
88     bool activateModule(SUIT_Study*);
89
90 protected slots:
91
92     void OnImportFromMEDFile();
93     void OnPartition1();
94     void OnPartition2();
95     void OnDecimate();
96     void OnRemove();
97     void OnSave();
98
99     void timerDone(); // update saving progress dialog
100
101 protected:
102
103     virtual CAM_DataModel* createDataModel();
104
105     void retrieveSelectedParts();
106     bool isPartExist(const char* partName);
107     bool removeLowerResolution();
108     
109 protected:
110
111     enum 
112     { 
113         ACTION_IMPORT_MED = 190,
114         ACTION_SAVE,
115         ACTION_REMOVE,
116         ACTION_SPLIT,
117         ACTION_DECIMATE
118     };
119     
120 private:
121
122     QString                      mMEDFileName;
123     QStringList                  mSelectedParts;
124     //MULTIPR_ORB::MULTIPR_Obj_ptr mMULTIPRObj;
125     MULTIPR_ORB::MULTIPR_Obj_var mMULTIPRObj;
126
127     QProgressDialog*             mProgress;
128     //MULTIPR_GUI_ProgressCallbackDlg* mProgress;
129     QTimer*                      mTimer;
130
131 }; // class MULTIPR_GUI
132
133
134 //*****************************************************************************
135 // Class MULTIPR_GUI_DataObject
136 // To use Object Browser
137 //*****************************************************************************
138
139 class MULTIPR_GUI_DataObject : public LightApp_DataObject
140 {
141 public:
142
143     MULTIPR_GUI_DataObject(SUIT_DataObject* parent, const char* name);
144     virtual ~MULTIPR_GUI_DataObject();
145     
146     virtual QString entry()   const;
147     virtual QString name()    const;
148     virtual QPixmap icon()    const;
149     virtual QString toolTip() const;
150
151 protected:
152
153     QString mName;
154 };
155
156
157 //*****************************************************************************
158 // Class MULTIPR_GUI_DataObject_Module
159 //*****************************************************************************
160
161 class MULTIPR_GUI_DataObject_Module : public MULTIPR_GUI_DataObject, public LightApp_ModuleObject
162 {
163 public:
164
165     MULTIPR_GUI_DataObject_Module(CAM_DataModel* dm, SUIT_DataObject* parent, const char* name);
166     virtual ~MULTIPR_GUI_DataObject_Module();
167     
168     virtual QString entry()   const;
169     virtual QString name()    const;
170     virtual QPixmap icon()    const;
171     virtual QString toolTip() const;
172 };
173
174
175 //*****************************************************************************
176 // Class MULTIPR_GUI_DataObject_Mesh
177 //*****************************************************************************
178
179 class MULTIPR_GUI_DataObject_Mesh : public MULTIPR_GUI_DataObject
180 {
181 public:
182
183     MULTIPR_GUI_DataObject_Mesh(SUIT_DataObject* parent, const char* name);
184     virtual ~MULTIPR_GUI_DataObject_Mesh();
185     
186     virtual QString entry()   const;
187     virtual QPixmap icon()    const;
188     virtual QString toolTip() const;
189 };
190
191
192 //*****************************************************************************
193 // Class MULTIPR_GUI_DataObject_Part
194 //*****************************************************************************
195
196 class MULTIPR_GUI_DataObject_Part : public MULTIPR_GUI_DataObject
197 {
198 public:
199
200     MULTIPR_GUI_DataObject_Part(SUIT_DataObject* parent, const char* name, const char* info);
201     virtual ~MULTIPR_GUI_DataObject_Part();
202     
203     virtual QString entry()   const;
204     virtual QPixmap icon()    const;
205     virtual QString toolTip() const;
206
207 protected:
208
209     QString mMeshName;
210     int     mId;
211     QString mPath;
212     QString mMEDFileName;
213     QString mTooltip;
214 };
215
216
217 //*****************************************************************************
218 // Class MULTIPR_GUI_DataObject_Resolution
219 //*****************************************************************************
220
221 class MULTIPR_GUI_DataObject_Resolution : public MULTIPR_GUI_DataObject_Part
222 {
223 public:
224
225     MULTIPR_GUI_DataObject_Resolution(SUIT_DataObject* parent, const char* name, const char* info);
226     virtual ~MULTIPR_GUI_DataObject_Resolution();
227     
228     virtual QString entry()   const;
229     virtual QPixmap icon()    const;
230     virtual QString toolTip() const;
231 };
232
233
234 //*****************************************************************************
235 // Class MULTIPR_GUI_DataModel
236 //*****************************************************************************
237
238 //class MULTIPR_GUI_DataModel : public LightApp_DataModel
239 class MULTIPR_GUI_DataModel : public SalomeApp_DataModel
240 {
241 public:
242
243     MULTIPR_GUI_DataModel(CAM_Module*);
244     virtual ~MULTIPR_GUI_DataModel();
245
246     virtual void update (LightApp_DataObject* = 0, LightApp_Study* = 0);
247
248 protected:
249
250     virtual void build();
251     void buildAll (LightApp_Study* = 0);
252
253 private:
254
255     MULTIPR_GUI* mMULTIPR_GUI;
256 };
257
258
259 #endif // __MULTIPR_GUI__
260
261
262 // EOF