Salome HOME
0020321: EDF : Some windows do not appear depending on the platform (MinimumSizeHint())
[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_MeshEditPreview;
55
56 class SMESH::compute_error_array;
57
58 namespace SMESH
59 {
60   class TShapeDisplayer;
61 }
62
63 /*!
64  * \brief Base operation to compute a mesh and show computation errors
65  */
66 class SMESHGUI_EXPORT SMESHGUI_BaseComputeOp: public SMESHGUI_Operation
67 {
68   Q_OBJECT
69
70 public:
71   SMESHGUI_BaseComputeOp();
72   virtual ~SMESHGUI_BaseComputeOp();
73
74 protected:
75   virtual void                   startOperation();
76   virtual void                   stopOperation();
77
78   SMESHGUI_ComputeDlg*           computeDlg() const;
79   void                           computeMesh();
80   void                           showComputeResult( const bool,
81                                                     const bool,
82                                                     SMESH::compute_error_array_var&,
83                                                     const bool,
84                                                     const QString& );
85     
86 protected slots:
87   virtual bool                   onApply();
88   void                           onPreviewShape();
89   void                           onPublishShape();
90   void                           onShowBadMesh();
91   void                           currentCellChanged();
92
93 private:
94   QTableWidget*                  table();
95
96 private:
97   QPointer<SMESHGUI_ComputeDlg>  myCompDlg;
98
99 protected:
100   SMESH::SMESH_Mesh_var            myMesh;
101   GEOM::GEOM_Object_var            myMainShape;
102   SMESH::TShapeDisplayer*          myTShapeDisplayer;
103   SMESHGUI_MeshEditPreview*        myBadMeshDisplayer;
104   Handle(SALOME_InteractiveObject) myIObject;
105 };
106
107 /*!
108  * \brief Operation to compute a mesh and show computation errors
109  */
110 class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
111 {
112   Q_OBJECT
113
114 public:
115   SMESHGUI_ComputeOp();
116   virtual ~SMESHGUI_ComputeOp();
117
118   virtual LightApp_Dialog*       dlg() const;
119
120 protected:
121   virtual void                   startOperation();
122
123 protected slots:
124 };
125
126 /*!
127  * \brief Operation to preview and compute a mesh and show computation errors
128  */
129 class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
130 {
131   Q_OBJECT
132
133 public:
134   SMESHGUI_PrecomputeOp();
135   virtual ~SMESHGUI_PrecomputeOp();
136
137   virtual LightApp_Dialog*       dlg() const;
138
139 protected:
140   virtual void                   startOperation();
141   virtual void                   stopOperation();
142   virtual void                   resumeOperation();
143
144   virtual void                   initDialog();
145
146 protected slots:
147   virtual void                   onCancel();
148
149 private slots:
150   void                           onPreview();
151   void                           onCompute();
152
153 private:
154   QMap< int, int >               myMapShapeId;
155   QPointer<LightApp_Dialog>      myActiveDlg;
156   QPointer<SMESHGUI_PrecomputeDlg> myDlg;
157   SMESHGUI_MeshEditPreview*      myPreviewDisplayer;
158 };
159
160 /*!
161  * \brief Box showing mesh info
162  */
163
164 class SMESHGUI_EXPORT SMESHGUI_MeshInfosBox : public QGroupBox
165 {
166   Q_OBJECT
167
168 public:
169   SMESHGUI_MeshInfosBox( const bool, QWidget* );
170
171   void    SetInfoByMesh( SMESH::SMESH_Mesh_var );
172
173 private:
174   bool    myFull;
175   QLabel* myNbNode;
176   QLabel* myNbEdge;
177   QLabel* myNbLinEdge;
178   QLabel* myNbQuadEdge;
179   QLabel* myNbTrai;
180   QLabel* myNbLinTrai;
181   QLabel* myNbQuadTrai;
182   QLabel* myNbQuad;
183   QLabel* myNbLinQuad;
184   QLabel* myNbQuadQuad;
185   QLabel* myNbFace;
186   QLabel* myNbLinFace;
187   QLabel* myNbQuadFace;
188   QLabel* myNbPolyg;
189   QLabel* myNbHexa;
190   QLabel* myNbLinHexa;
191   QLabel* myNbQuadHexa;
192   QLabel* myNbTetra;
193   QLabel* myNbLinTetra;
194   QLabel* myNbQuadTetra;
195   QLabel* myNbPyra;
196   QLabel* myNbLinPyra;
197   QLabel* myNbQuadPyra;
198   QLabel* myNbPrism;
199   QLabel* myNbLinPrism;
200   QLabel* myNbQuadPrism;
201   QLabel* myNbVolum;
202   QLabel* myNbLinVolum;
203   QLabel* myNbQuadVolum;
204   QLabel* myNbPolyh;
205 };
206
207 /*!
208  * \brief Dialog to compute a mesh and show computation errors
209  */
210
211 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
212 {
213   Q_OBJECT
214
215 public:
216   SMESHGUI_ComputeDlg( QWidget* );
217   virtual ~SMESHGUI_ComputeDlg();
218
219 protected:
220   QFrame*                      createMainFrame( QWidget* );
221
222   QLabel*                      myMeshName;
223   QGroupBox*                   myMemoryLackGroup;
224   QGroupBox*                   myCompErrorGroup;
225   QGroupBox*                   myHypErrorGroup;
226   QLabel*                      myHypErrorLabel;
227   QTableWidget*                myTable;
228   QPushButton*                 myShowBtn;
229   QPushButton*                 myPublishBtn;
230   QPushButton*                 myBadMeshBtn;
231
232   SMESHGUI_MeshInfosBox*       myBriefInfo;
233   SMESHGUI_MeshInfosBox*       myFullInfo;
234
235   friend class SMESHGUI_BaseComputeOp;
236   friend class SMESHGUI_PrecomputeOp;
237 };
238
239 /*!
240  * \brief Dialog to preview and compute a mesh and show computation errors
241  */
242
243 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
244 {
245   Q_OBJECT
246
247 public:
248   SMESHGUI_PrecomputeDlg( QWidget* );
249   virtual ~SMESHGUI_PrecomputeDlg();
250   
251   void                         setPreviewModes( const QList<int>& );
252   int                          getPreviewMode() const;
253
254 signals:
255   void                         preview();
256
257 private:
258   QPushButton*                 myPreviewBtn;
259   QtxComboBox*                 myPreviewMode;
260 };
261
262
263 #endif // SMESHGUI_COMPUTEDLG_H