Salome HOME
0020452: EDF 1056 SMESH : 2D Projection Issue
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ComputeDlg.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : SMESHGUI_ComputeDlg.h
23 // Author : Edward AGAPOV, Open CASCADE S.A.S.
24 //
25 #ifndef SMESHGUI_COMPUTEDLG_H
26 #define SMESHGUI_COMPUTEDLG_H
27
28 // SMESH includes
29 #include "SMESH_SMESHGUI.hxx"
30
31 #include "SMESHGUI_Dialog.h"
32 #include "SMESHGUI_Operation.h"
33
34 // SALOME GUI includes
35 #include <SALOME_InteractiveObject.hxx>
36
37 // Qt includes
38 #include <QMap>
39 #include <QPointer>
40 #include <QGroupBox>
41
42 // IDL includes
43 #include <SALOMEconfig.h>
44 #include CORBA_SERVER_HEADER(SMESH_Gen)
45 #include CORBA_SERVER_HEADER(SMESH_Mesh)
46
47 class QFrame;
48 class QPushButton;
49 class QTableWidget;
50 class QLabel;
51 class QtxComboBox;
52 class SMESHGUI_ComputeDlg;
53 class SMESHGUI_PrecomputeDlg;
54 //class SMESHGUI_EvaluateDlg;
55 class SMESHGUI_MeshEditPreview;
56
57 class SMESH::compute_error_array;
58
59 namespace SMESH
60 {
61   class TShapeDisplayer;
62 }
63
64 /*!
65  * \brief Base operation to compute a mesh and show computation errors
66  */
67 class SMESHGUI_EXPORT SMESHGUI_BaseComputeOp: public SMESHGUI_Operation
68 {
69   Q_OBJECT
70
71 public:
72   SMESHGUI_BaseComputeOp();
73   virtual ~SMESHGUI_BaseComputeOp();
74
75 protected:
76   virtual void                   startOperation();
77   virtual void                   stopOperation();
78
79   SMESHGUI_ComputeDlg*           computeDlg() const;
80   void                           computeMesh();
81   void                           showComputeResult( const bool,
82                                                     const bool,
83                                                     SMESH::compute_error_array_var&,
84                                                     const bool,
85                                                     const QString& );
86   //SMESHGUI_EvaluateDlg*          evaluateDlg() const;
87   SMESHGUI_ComputeDlg*           evaluateDlg() const;
88   void                           evaluateMesh();
89   void                           showEvaluateResult(std::vector<int> theVec,
90                                                     const bool,
91                                                     const bool,
92                                                     SMESH::compute_error_array_var&,
93                                                     const bool,
94                                                     const QString&);
95     
96 protected slots:
97   virtual bool                   onApply();
98   void                           onPreviewShape();
99   void                           onPublishShape();
100   void                           onShowBadMesh();
101   void                           currentCellChanged();
102
103 private:
104   QTableWidget*                  table();
105
106 private:
107   QPointer<SMESHGUI_ComputeDlg>  myCompDlg;
108   //QPointer<SMESHGUI_EvaluateDlg> myEvalDlg;
109
110 protected:
111   SMESH::SMESH_Mesh_var            myMesh;
112   GEOM::GEOM_Object_var            myMainShape;
113   SMESH::TShapeDisplayer*          myTShapeDisplayer;
114   SMESHGUI_MeshEditPreview*        myBadMeshDisplayer;
115   Handle(SALOME_InteractiveObject) myIObject;
116 };
117
118 /*!
119  * \brief Operation to compute a mesh and show computation errors
120  */
121 class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
122 {
123   Q_OBJECT
124
125 public:
126   SMESHGUI_ComputeOp();
127   virtual ~SMESHGUI_ComputeOp();
128
129   virtual LightApp_Dialog*       dlg() const;
130
131 protected:
132   virtual void                   startOperation();
133
134 protected slots:
135 };
136
137 /*!
138  * \brief Operation to preview and compute a mesh and show computation errors
139  */
140 class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
141 {
142   Q_OBJECT
143
144 public:
145   SMESHGUI_PrecomputeOp();
146   virtual ~SMESHGUI_PrecomputeOp();
147
148   virtual LightApp_Dialog*       dlg() const;
149
150   /**
151    * \brief returns map of assigned algorithms modes
152    */
153   static void                    getAssignedAlgos(_PTR(SObject) theMesh,
154                                                   QMap<int,int>& theModeMap);
155
156 protected:
157   virtual void                   startOperation();
158   virtual void                   stopOperation();
159   virtual void                   resumeOperation();
160
161   virtual void                   initDialog();
162
163 protected slots:
164   virtual void                   onCancel();
165
166 private slots:
167   void                           onPreview();
168   void                           onCompute();
169
170 private:
171   QMap< int, int >               myMapShapeId;
172   QPointer<LightApp_Dialog>      myActiveDlg;
173   QPointer<SMESHGUI_PrecomputeDlg> myDlg;
174   SMESHGUI_MeshEditPreview*      myPreviewDisplayer;
175 };
176
177 /*!
178  * \brief Operation to evaluate a mesh and show result
179  */
180 class SMESHGUI_EXPORT SMESHGUI_EvaluateOp: public SMESHGUI_BaseComputeOp
181 {
182   Q_OBJECT
183
184 public:
185   SMESHGUI_EvaluateOp();
186   virtual ~SMESHGUI_EvaluateOp();
187
188   virtual LightApp_Dialog*       dlg() const;
189
190 protected:
191   virtual void                   startOperation();
192
193 protected slots:
194 };
195
196 /*!
197  * \brief Box showing mesh info
198  */
199
200 class SMESHGUI_EXPORT SMESHGUI_MeshInfosBox : public QGroupBox
201 {
202   Q_OBJECT
203
204 public:
205   SMESHGUI_MeshInfosBox( const bool, QWidget* );
206
207   void    SetInfoByMesh( SMESH::SMESH_Mesh_var );
208
209   void    SetInfoByEval( std::vector<int> theVec );
210
211 private:
212   bool    myFull;
213   QLabel* myNbNode;
214   QLabel* myNbEdge;
215   QLabel* myNbLinEdge;
216   QLabel* myNbQuadEdge;
217   QLabel* myNbTrai;
218   QLabel* myNbLinTrai;
219   QLabel* myNbQuadTrai;
220   QLabel* myNbQuad;
221   QLabel* myNbLinQuad;
222   QLabel* myNbQuadQuad;
223   QLabel* myNbFace;
224   QLabel* myNbLinFace;
225   QLabel* myNbQuadFace;
226   QLabel* myNbPolyg;
227   QLabel* myNbHexa;
228   QLabel* myNbLinHexa;
229   QLabel* myNbQuadHexa;
230   QLabel* myNbTetra;
231   QLabel* myNbLinTetra;
232   QLabel* myNbQuadTetra;
233   QLabel* myNbPyra;
234   QLabel* myNbLinPyra;
235   QLabel* myNbQuadPyra;
236   QLabel* myNbPrism;
237   QLabel* myNbLinPrism;
238   QLabel* myNbQuadPrism;
239   QLabel* myNbVolum;
240   QLabel* myNbLinVolum;
241   QLabel* myNbQuadVolum;
242   QLabel* myNbPolyh;
243 };
244
245 /*!
246  * \brief Dialog to compute a mesh and show computation errors
247  */
248
249 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
250 {
251   Q_OBJECT
252
253 public:
254   SMESHGUI_ComputeDlg( QWidget*, bool );
255   virtual ~SMESHGUI_ComputeDlg();
256
257 protected:
258   QFrame*                      createMainFrame( QWidget*, bool );
259
260   QLabel*                      myMeshName;
261   QGroupBox*                   myMemoryLackGroup;
262   QGroupBox*                   myCompErrorGroup;
263   QGroupBox*                   myHypErrorGroup;
264   QLabel*                      myHypErrorLabel;
265   QTableWidget*                myTable;
266   QPushButton*                 myShowBtn;
267   QPushButton*                 myPublishBtn;
268   QPushButton*                 myBadMeshBtn;
269
270   SMESHGUI_MeshInfosBox*       myBriefInfo;
271   SMESHGUI_MeshInfosBox*       myFullInfo;
272
273   friend class SMESHGUI_BaseComputeOp;
274   friend class SMESHGUI_PrecomputeOp;
275 };
276
277 /*!
278  * \brief Dialog to preview and compute a mesh and show computation errors
279  */
280
281 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
282 {
283   Q_OBJECT
284
285 public:
286   SMESHGUI_PrecomputeDlg( QWidget* );
287   virtual ~SMESHGUI_PrecomputeDlg();
288   
289   void                         setPreviewModes( const QList<int>& );
290   int                          getPreviewMode() const;
291
292 signals:
293   void                         preview();
294
295 private:
296   QPushButton*                 myPreviewBtn;
297   QtxComboBox*                 myPreviewMode;
298 };
299
300
301 /*!
302  * \brief Dialog to evaluate a mesh and show result
303  */
304 /*
305 class SMESHGUI_EXPORT SMESHGUI_EvaluateDlg : public SMESHGUI_Dialog
306 {
307   Q_OBJECT
308
309 public:
310   SMESHGUI_EvaluateDlg( QWidget* );
311   virtual ~SMESHGUI_EvaluateDlg();
312
313 protected:
314   QFrame*                      createMainFrame( QWidget* );
315
316   QLabel*                      myMeshName;
317   QGroupBox*                   myMemoryLackGroup;
318   QGroupBox*                   myCompErrorGroup;
319   QGroupBox*                   myHypErrorGroup;
320   QLabel*                      myHypErrorLabel;
321   QTableWidget*                myTable;
322   QPushButton*                 myShowBtn;
323   QPushButton*                 myPublishBtn;
324   QPushButton*                 myBadMeshBtn;
325
326   SMESHGUI_MeshInfosBox*       myBriefInfo;
327   SMESHGUI_MeshInfosBox*       myFullInfo;
328
329   friend class SMESHGUI_BaseComputeOp;
330 };
331 */
332
333 #endif // SMESHGUI_COMPUTEDLG_H