Salome HOME
Implememtation of evaluation for improvement 0019296.
[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 protected:
151   virtual void                   startOperation();
152   virtual void                   stopOperation();
153   virtual void                   resumeOperation();
154
155   virtual void                   initDialog();
156
157 protected slots:
158   virtual void                   onCancel();
159
160 private slots:
161   void                           onPreview();
162   void                           onCompute();
163
164 private:
165   QMap< int, int >               myMapShapeId;
166   QPointer<LightApp_Dialog>      myActiveDlg;
167   QPointer<SMESHGUI_PrecomputeDlg> myDlg;
168   SMESHGUI_MeshEditPreview*      myPreviewDisplayer;
169 };
170
171 /*!
172  * \brief Operation to evaluate a mesh and show result
173  */
174 class SMESHGUI_EXPORT SMESHGUI_EvaluateOp: public SMESHGUI_BaseComputeOp
175 {
176   Q_OBJECT
177
178 public:
179   SMESHGUI_EvaluateOp();
180   virtual ~SMESHGUI_EvaluateOp();
181
182   virtual LightApp_Dialog*       dlg() const;
183
184 protected:
185   virtual void                   startOperation();
186
187 protected slots:
188 };
189
190 /*!
191  * \brief Box showing mesh info
192  */
193
194 class SMESHGUI_EXPORT SMESHGUI_MeshInfosBox : public QGroupBox
195 {
196   Q_OBJECT
197
198 public:
199   SMESHGUI_MeshInfosBox( const bool, QWidget* );
200
201   void    SetInfoByMesh( SMESH::SMESH_Mesh_var );
202
203   void    SetInfoByEval( std::vector<int> theVec );
204
205 private:
206   bool    myFull;
207   QLabel* myNbNode;
208   QLabel* myNbEdge;
209   QLabel* myNbLinEdge;
210   QLabel* myNbQuadEdge;
211   QLabel* myNbTrai;
212   QLabel* myNbLinTrai;
213   QLabel* myNbQuadTrai;
214   QLabel* myNbQuad;
215   QLabel* myNbLinQuad;
216   QLabel* myNbQuadQuad;
217   QLabel* myNbFace;
218   QLabel* myNbLinFace;
219   QLabel* myNbQuadFace;
220   QLabel* myNbPolyg;
221   QLabel* myNbHexa;
222   QLabel* myNbLinHexa;
223   QLabel* myNbQuadHexa;
224   QLabel* myNbTetra;
225   QLabel* myNbLinTetra;
226   QLabel* myNbQuadTetra;
227   QLabel* myNbPyra;
228   QLabel* myNbLinPyra;
229   QLabel* myNbQuadPyra;
230   QLabel* myNbPrism;
231   QLabel* myNbLinPrism;
232   QLabel* myNbQuadPrism;
233   QLabel* myNbVolum;
234   QLabel* myNbLinVolum;
235   QLabel* myNbQuadVolum;
236   QLabel* myNbPolyh;
237 };
238
239 /*!
240  * \brief Dialog to compute a mesh and show computation errors
241  */
242
243 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
244 {
245   Q_OBJECT
246
247 public:
248   SMESHGUI_ComputeDlg( QWidget*, bool );
249   virtual ~SMESHGUI_ComputeDlg();
250
251 protected:
252   QFrame*                      createMainFrame( QWidget*, bool );
253
254   QLabel*                      myMeshName;
255   QGroupBox*                   myMemoryLackGroup;
256   QGroupBox*                   myCompErrorGroup;
257   QGroupBox*                   myHypErrorGroup;
258   QLabel*                      myHypErrorLabel;
259   QTableWidget*                myTable;
260   QPushButton*                 myShowBtn;
261   QPushButton*                 myPublishBtn;
262   QPushButton*                 myBadMeshBtn;
263
264   SMESHGUI_MeshInfosBox*       myBriefInfo;
265   SMESHGUI_MeshInfosBox*       myFullInfo;
266
267   friend class SMESHGUI_BaseComputeOp;
268   friend class SMESHGUI_PrecomputeOp;
269 };
270
271 /*!
272  * \brief Dialog to preview and compute a mesh and show computation errors
273  */
274
275 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
276 {
277   Q_OBJECT
278
279 public:
280   SMESHGUI_PrecomputeDlg( QWidget* );
281   virtual ~SMESHGUI_PrecomputeDlg();
282   
283   void                         setPreviewModes( const QList<int>& );
284   int                          getPreviewMode() const;
285
286 signals:
287   void                         preview();
288
289 private:
290   QPushButton*                 myPreviewBtn;
291   QtxComboBox*                 myPreviewMode;
292 };
293
294
295 /*!
296  * \brief Dialog to evaluate a mesh and show result
297  */
298 /*
299 class SMESHGUI_EXPORT SMESHGUI_EvaluateDlg : public SMESHGUI_Dialog
300 {
301   Q_OBJECT
302
303 public:
304   SMESHGUI_EvaluateDlg( QWidget* );
305   virtual ~SMESHGUI_EvaluateDlg();
306
307 protected:
308   QFrame*                      createMainFrame( QWidget* );
309
310   QLabel*                      myMeshName;
311   QGroupBox*                   myMemoryLackGroup;
312   QGroupBox*                   myCompErrorGroup;
313   QGroupBox*                   myHypErrorGroup;
314   QLabel*                      myHypErrorLabel;
315   QTableWidget*                myTable;
316   QPushButton*                 myShowBtn;
317   QPushButton*                 myPublishBtn;
318   QPushButton*                 myBadMeshBtn;
319
320   SMESHGUI_MeshInfosBox*       myBriefInfo;
321   SMESHGUI_MeshInfosBox*       myFullInfo;
322
323   friend class SMESHGUI_BaseComputeOp;
324 };
325 */
326
327 #endif // SMESHGUI_COMPUTEDLG_H