1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SMESHGUI_ComputeDlg.h
21 // Author : Edward AGAPOV, Open CASCADE S.A.S.
23 #ifndef SMESHGUI_COMPUTEDLG_H
24 #define SMESHGUI_COMPUTEDLG_H
27 #include "SMESH_SMESHGUI.hxx"
29 #include "SMESHGUI_Dialog.h"
30 #include "SMESHGUI_Operation.h"
32 // SALOME GUI includes
33 #include <SALOME_InteractiveObject.hxx>
43 #include <SALOMEconfig.h>
44 #include CORBA_SERVER_HEADER(SMESH_Gen)
45 #include CORBA_SERVER_HEADER(SMESH_Mesh)
52 class SMESHGUI_ComputeDlg;
53 class SMESHGUI_MeshInfosBox;
54 class SMESHGUI_PrecomputeDlg;
55 class SMESHGUI_MeshEditPreview;
59 class TShapeDisplayer;
63 * \brief Base operation to compute a mesh and show computation errors
65 class SMESHGUI_EXPORT SMESHGUI_BaseComputeOp: public SMESHGUI_Operation
70 SMESHGUI_BaseComputeOp();
71 virtual ~SMESHGUI_BaseComputeOp();
73 SMESH::SMESH_Mesh_ptr getMesh();
76 virtual void startOperation();
77 virtual void stopOperation();
79 SMESHGUI_ComputeDlg* computeDlg() const;
81 void showComputeResult( const bool,
83 SMESH::compute_error_array_var&,
86 SMESHGUI_ComputeDlg* evaluateDlg() const;
88 void showEvaluateResult(const SMESH::long_array& theRes,
91 SMESH::compute_error_array_var&,
95 virtual bool isValid( SUIT_Operation* theOp ) const;
98 virtual bool onApply();
99 void onPreviewShape();
100 void onPublishShape();
101 void onShowBadMesh();
102 void onGroupOfBadMesh();
103 void currentCellChanged();
106 QTableWidget* table();
109 QPointer<SMESHGUI_ComputeDlg> myCompDlg;
112 SMESH::SMESH_Mesh_var myMesh;
113 GEOM::GEOM_Object_var myMainShape;
114 SMESH::TShapeDisplayer* myTShapeDisplayer;
115 SMESHGUI_MeshEditPreview* myBadMeshDisplayer;
116 Handle(SALOME_InteractiveObject) myIObject;
120 * \brief Operation to compute a mesh and show computation errors
122 class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
127 SMESHGUI_ComputeOp();
128 virtual ~SMESHGUI_ComputeOp();
130 virtual LightApp_Dialog* dlg() const;
133 virtual void startOperation();
138 class SMESHGUI_MeshOrderMgr;
141 * \brief Operation to preview and compute a mesh and show computation errors
143 class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
148 SMESHGUI_PrecomputeOp();
149 virtual ~SMESHGUI_PrecomputeOp();
151 virtual LightApp_Dialog* dlg() const;
154 * \brief returns map of assigned algorithms modes
156 static void getAssignedAlgos(_PTR(SObject) theMesh,
157 QMap<int,int>& theModeMap);
160 virtual void startOperation();
161 virtual void stopOperation();
162 virtual void resumeOperation();
164 virtual void initDialog();
167 virtual void onCancel();
175 QMap< int, int > myMapShapeId;
176 QPointer<LightApp_Dialog> myActiveDlg;
177 QPointer<SMESHGUI_PrecomputeDlg> myDlg;
178 SMESHGUI_MeshEditPreview* myPreviewDisplayer;
179 //! fields for mesh order
180 typedef QList<int> TListOfInt;
181 typedef QList<TListOfInt> TListOfListOfInt;
182 TListOfListOfInt myPrevOrder;
183 SMESHGUI_MeshOrderMgr* myOrderMgr;
187 * \brief Operation to evaluate a mesh and show result
189 class SMESHGUI_EXPORT SMESHGUI_EvaluateOp: public SMESHGUI_BaseComputeOp
194 SMESHGUI_EvaluateOp();
195 virtual ~SMESHGUI_EvaluateOp();
197 virtual LightApp_Dialog* dlg() const;
200 virtual void startOperation();
206 * \brief Dialog to compute a mesh and show computation errors
209 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
214 SMESHGUI_ComputeDlg( QWidget*, bool );
215 virtual ~SMESHGUI_ComputeDlg();
218 QFrame* createMainFrame( QWidget*, bool );
221 QGroupBox* myMemoryLackGroup;
222 QGroupBox* myCompErrorGroup;
223 QGroupBox* myHypErrorGroup;
224 QLabel* myHypErrorLabel;
225 QLabel* myWarningLabel;
226 QTableWidget* myTable;
227 QPushButton* myShowBtn;
228 QPushButton* myPublishBtn;
229 QPushButton* myBadMeshBtn;
230 QPushButton* myBadMeshToGroupBtn;
232 SMESHGUI_MeshInfosBox* myBriefInfo;
233 SMESHGUI_MeshInfosBox* myFullInfo;
235 friend class SMESHGUI_BaseComputeOp;
236 friend class SMESHGUI_PrecomputeOp;
239 class SMESHGUI_MeshOrderBox;
242 * \brief Dialog to preview and compute a mesh and show computation errors
245 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
250 SMESHGUI_PrecomputeDlg( QWidget* );
251 virtual ~SMESHGUI_PrecomputeDlg();
253 void setPreviewModes( const QList<int>& );
254 int getPreviewMode() const;
256 SMESHGUI_MeshOrderBox* getMeshOrderBox() const;
262 SMESHGUI_MeshOrderBox* myOrderBox;
263 QPushButton* myPreviewBtn;
264 QtxComboBox* myPreviewMode;
268 * \brief Thread to launch computation
271 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThread : public QThread
276 SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var gen,
277 SMESH::SMESH_Mesh_var mesh,
278 GEOM::GEOM_Object_var mainShape);
281 SMESH::SMESH_Mesh_var& getMesh() { return myMesh; }
287 SMESH::SMESH_Gen_var myGen;
288 SMESH::SMESH_Mesh_var myMesh;
289 GEOM::GEOM_Object_var myMainShape;
294 * \brief Dialog to display Cancel button
297 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThreadQDialog : public QDialog
302 SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent,
303 SMESH::SMESH_Gen_var gen,
304 SMESH::SMESH_Mesh_var mesh,
305 GEOM::GEOM_Object_var mainShape);
309 void timerEvent(QTimerEvent *timer);
310 void closeEvent(QCloseEvent *event);
316 SMESHGUI_ComputeDlg_QThread qthread;
317 QPushButton * cancelButton;
318 QLabel * nbNodesLabel;
319 QLabel * nbElemsLabel;
322 #endif // SMESHGUI_COMPUTEDLG_H