Salome HOME
IMP 0019925 (Improve Precompute modes detection)
[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   /**
140    * \brief returns map of assigned algorithms modes
141    */
142   static void                    getAssignedAlgos(_PTR(SObject) theMesh,
143                                                   QMap<int,int>& theModeMap);
144
145 protected:
146   virtual void                   startOperation();
147   virtual void                   stopOperation();
148   virtual void                   resumeOperation();
149
150   virtual void                   initDialog();
151
152 protected slots:
153   virtual void                   onCancel();
154
155 private slots:
156   void                           onPreview();
157   void                           onCompute();
158
159 private:
160   QMap< int, int >               myMapShapeId;
161   QPointer<LightApp_Dialog>      myActiveDlg;
162   QPointer<SMESHGUI_PrecomputeDlg> myDlg;
163   SMESHGUI_MeshEditPreview*      myPreviewDisplayer;
164 };
165
166 /*!
167  * \brief Box showing mesh info
168  */
169
170 class SMESHGUI_EXPORT SMESHGUI_MeshInfosBox : public QGroupBox
171 {
172   Q_OBJECT
173
174 public:
175   SMESHGUI_MeshInfosBox( const bool, QWidget* );
176
177   void    SetInfoByMesh( SMESH::SMESH_Mesh_var );
178
179 private:
180   bool    myFull;
181   QLabel* myNbNode;
182   QLabel* myNbEdge;
183   QLabel* myNbLinEdge;
184   QLabel* myNbQuadEdge;
185   QLabel* myNbTrai;
186   QLabel* myNbLinTrai;
187   QLabel* myNbQuadTrai;
188   QLabel* myNbQuad;
189   QLabel* myNbLinQuad;
190   QLabel* myNbQuadQuad;
191   QLabel* myNbFace;
192   QLabel* myNbLinFace;
193   QLabel* myNbQuadFace;
194   QLabel* myNbPolyg;
195   QLabel* myNbHexa;
196   QLabel* myNbLinHexa;
197   QLabel* myNbQuadHexa;
198   QLabel* myNbTetra;
199   QLabel* myNbLinTetra;
200   QLabel* myNbQuadTetra;
201   QLabel* myNbPyra;
202   QLabel* myNbLinPyra;
203   QLabel* myNbQuadPyra;
204   QLabel* myNbPrism;
205   QLabel* myNbLinPrism;
206   QLabel* myNbQuadPrism;
207   QLabel* myNbVolum;
208   QLabel* myNbLinVolum;
209   QLabel* myNbQuadVolum;
210   QLabel* myNbPolyh;
211 };
212
213 /*!
214  * \brief Dialog to compute a mesh and show computation errors
215  */
216
217 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
218 {
219   Q_OBJECT
220
221 public:
222   SMESHGUI_ComputeDlg( QWidget* );
223   virtual ~SMESHGUI_ComputeDlg();
224
225 protected:
226   QFrame*                      createMainFrame( QWidget* );
227
228   QLabel*                      myMeshName;
229   QGroupBox*                   myMemoryLackGroup;
230   QGroupBox*                   myCompErrorGroup;
231   QGroupBox*                   myHypErrorGroup;
232   QLabel*                      myHypErrorLabel;
233   QTableWidget*                myTable;
234   QPushButton*                 myShowBtn;
235   QPushButton*                 myPublishBtn;
236   QPushButton*                 myBadMeshBtn;
237
238   SMESHGUI_MeshInfosBox*       myBriefInfo;
239   SMESHGUI_MeshInfosBox*       myFullInfo;
240
241   friend class SMESHGUI_BaseComputeOp;
242   friend class SMESHGUI_PrecomputeOp;
243 };
244
245 /*!
246  * \brief Dialog to preview and compute a mesh and show computation errors
247  */
248
249 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
250 {
251   Q_OBJECT
252
253 public:
254   SMESHGUI_PrecomputeDlg( QWidget* );
255   virtual ~SMESHGUI_PrecomputeDlg();
256   
257   void                         setPreviewModes( const QList<int>& );
258   int                          getPreviewMode() const;
259
260 signals:
261   void                         preview();
262
263 private:
264   QPushButton*                 myPreviewBtn;
265   QtxComboBox*                 myPreviewMode;
266 };
267
268
269 #endif // SMESHGUI_COMPUTEDLG_H