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