Salome HOME
Corrected for 0020310.
[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_MeshInfosBox;
54 class SMESHGUI_PrecomputeDlg;
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_ComputeDlg*           evaluateDlg() const;
87   void                           evaluateMesh();
88   void                           showEvaluateResult(const SMESH::long_array& theRes,
89                                                     const bool,
90                                                     const bool,
91                                                     SMESH::compute_error_array_var&,
92                                                     const bool,
93                                                     const QString&);
94     
95 protected slots:
96   virtual bool                   onApply();
97   void                           onPreviewShape();
98   void                           onPublishShape();
99   void                           onShowBadMesh();
100   void                           currentCellChanged();
101
102 private:
103   QTableWidget*                  table();
104
105 private:
106   QPointer<SMESHGUI_ComputeDlg>  myCompDlg;
107
108 protected:
109   SMESH::SMESH_Mesh_var            myMesh;
110   GEOM::GEOM_Object_var            myMainShape;
111   SMESH::TShapeDisplayer*          myTShapeDisplayer;
112   SMESHGUI_MeshEditPreview*        myBadMeshDisplayer;
113   Handle(SALOME_InteractiveObject) myIObject;
114 };
115
116 /*!
117  * \brief Operation to compute a mesh and show computation errors
118  */
119 class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
120 {
121   Q_OBJECT
122
123 public:
124   SMESHGUI_ComputeOp();
125   virtual ~SMESHGUI_ComputeOp();
126
127   virtual LightApp_Dialog*       dlg() const;
128
129 protected:
130   virtual void                   startOperation();
131
132 protected slots:
133 };
134
135 /*!
136  * \brief Operation to preview and compute a mesh and show computation errors
137  */
138 class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
139 {
140   Q_OBJECT
141
142 public:
143   SMESHGUI_PrecomputeOp();
144   virtual ~SMESHGUI_PrecomputeOp();
145
146   virtual LightApp_Dialog*       dlg() const;
147
148   /**
149    * \brief returns map of assigned algorithms modes
150    */
151   static void                    getAssignedAlgos(_PTR(SObject) theMesh,
152                                                   QMap<int,int>& theModeMap);
153
154 protected:
155   virtual void                   startOperation();
156   virtual void                   stopOperation();
157   virtual void                   resumeOperation();
158
159   virtual void                   initDialog();
160
161 protected slots:
162   virtual void                   onCancel();
163
164 private slots:
165   void                           onPreview();
166   void                           onCompute();
167
168 private:
169   QMap< int, int >               myMapShapeId;
170   QPointer<LightApp_Dialog>      myActiveDlg;
171   QPointer<SMESHGUI_PrecomputeDlg> myDlg;
172   SMESHGUI_MeshEditPreview*      myPreviewDisplayer;
173 };
174
175 /*!
176  * \brief Operation to evaluate a mesh and show result
177  */
178 class SMESHGUI_EXPORT SMESHGUI_EvaluateOp: public SMESHGUI_BaseComputeOp
179 {
180   Q_OBJECT
181
182 public:
183   SMESHGUI_EvaluateOp();
184   virtual ~SMESHGUI_EvaluateOp();
185
186   virtual LightApp_Dialog*       dlg() const;
187
188 protected:
189   virtual void                   startOperation();
190
191 protected slots:
192 };
193
194 /*!
195  * \brief Dialog to compute a mesh and show computation errors
196  */
197
198 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
199 {
200   Q_OBJECT
201
202 public:
203   SMESHGUI_ComputeDlg( QWidget*, bool );
204   virtual ~SMESHGUI_ComputeDlg();
205
206 protected:
207   QFrame*                      createMainFrame( QWidget*, bool );
208
209   QLabel*                      myMeshName;
210   QGroupBox*                   myMemoryLackGroup;
211   QGroupBox*                   myCompErrorGroup;
212   QGroupBox*                   myHypErrorGroup;
213   QLabel*                      myHypErrorLabel;
214   QTableWidget*                myTable;
215   QPushButton*                 myShowBtn;
216   QPushButton*                 myPublishBtn;
217   QPushButton*                 myBadMeshBtn;
218
219   SMESHGUI_MeshInfosBox*       myBriefInfo;
220   SMESHGUI_MeshInfosBox*       myFullInfo;
221
222   friend class SMESHGUI_BaseComputeOp;
223   friend class SMESHGUI_PrecomputeOp;
224 };
225
226 /*!
227  * \brief Dialog to preview and compute a mesh and show computation errors
228  */
229
230 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
231 {
232   Q_OBJECT
233
234 public:
235   SMESHGUI_PrecomputeDlg( QWidget* );
236   virtual ~SMESHGUI_PrecomputeDlg();
237   
238   void                         setPreviewModes( const QList<int>& );
239   int                          getPreviewMode() const;
240
241 signals:
242   void                         preview();
243
244 private:
245   QPushButton*                 myPreviewBtn;
246   QtxComboBox*                 myPreviewMode;
247 };
248
249 #endif // SMESHGUI_COMPUTEDLG_H