1 // Copyright (C) 2007-2024 CEA, EDF, 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, or (at your option) any later version.
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)
53 class SMESHGUI_ComputeDlg;
54 class SMESHGUI_MeshInfosBox;
55 class SMESHGUI_PrecomputeDlg;
56 class SMESHGUI_MeshEditPreview;
60 class TShapeDisplayer;
64 * \brief Base operation to compute a mesh and show computation errors
66 class SMESHGUI_EXPORT SMESHGUI_BaseComputeOp: public SMESHGUI_Operation
71 SMESHGUI_BaseComputeOp();
72 virtual ~SMESHGUI_BaseComputeOp();
74 SMESH::SMESH_Mesh_ptr getMesh();
75 virtual LightApp_Dialog* dlg() const;
78 virtual void startOperation();
79 virtual void stopOperation();
81 SMESHGUI_ComputeDlg* computeDlg() const;
83 void showComputeResult( const bool,
85 SMESH::compute_error_array_var&,
88 SMESHGUI_ComputeDlg* evaluateDlg() const;
90 void showEvaluateResult(const SMESH::smIdType_array& theRes,
93 SMESH::compute_error_array_var&,
97 virtual bool isValid( SUIT_Operation* theOp ) const;
101 virtual bool onApply();
102 void onPreviewShape();
103 void onPublishShape();
104 void onShowBadMesh();
105 void onGroupOfBadMesh();
106 void currentCellChanged();
109 QTableWidget* table();
112 QPointer<SMESHGUI_ComputeDlg> myCompDlg;
115 SMESH::SMESH_Mesh_var myMesh;
116 GEOM::GEOM_Object_var myMainShape;
117 GEOM::GEOM_Object_var myCurShape;
118 SMESH::TShapeDisplayer* myTShapeDisplayer;
119 SMESHGUI_MeshEditPreview* myBadMeshDisplayer;
120 Handle(SALOME_InteractiveObject) myIObject;
124 * \brief Operation to compute a mesh and show computation errors
126 class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
131 SMESHGUI_ComputeOp();
132 virtual ~SMESHGUI_ComputeOp();
134 virtual LightApp_Dialog* dlg() const;
137 virtual void startOperation();
142 class SMESHGUI_MeshOrderMgr;
145 * \brief Operation to preview and compute a mesh and show computation errors
147 class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
152 SMESHGUI_PrecomputeOp();
153 virtual ~SMESHGUI_PrecomputeOp();
155 virtual LightApp_Dialog* dlg() const;
158 * \brief returns map of assigned algorithms modes
160 static void getAssignedAlgos(_PTR(SObject) theMesh,
161 QMap<int,int>& theModeMap);
164 virtual void startOperation();
165 virtual void stopOperation();
166 virtual void resumeOperation();
168 virtual void initDialog();
171 virtual void onCancel();
179 QMap< int, int > myMapShapeId;
180 QPointer<LightApp_Dialog> myActiveDlg;
181 QPointer<SMESHGUI_PrecomputeDlg> myDlg;
182 SMESHGUI_MeshEditPreview* myPreviewDisplayer;
183 //! fields for mesh order
184 typedef QList<int> TListOfInt;
185 typedef QList<TListOfInt> TListOfListOfInt;
186 TListOfListOfInt myPrevOrder;
187 SMESHGUI_MeshOrderMgr* myOrderMgr;
191 * \brief Operation to evaluate a mesh and show result
193 class SMESHGUI_EXPORT SMESHGUI_EvaluateOp: public SMESHGUI_BaseComputeOp
198 SMESHGUI_EvaluateOp();
199 virtual ~SMESHGUI_EvaluateOp();
201 virtual LightApp_Dialog* dlg() const;
204 virtual void startOperation();
210 * \brief Operation to show meshing errors
212 class SMESHGUI_EXPORT SMESHGUI_ShowErrorsOp: public SMESHGUI_BaseComputeOp
217 SMESHGUI_ShowErrorsOp();
220 virtual void startOperation();
224 * \brief Dialog to compute a mesh and show computation errors
227 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
232 SMESHGUI_ComputeDlg( QWidget*, bool );
233 virtual ~SMESHGUI_ComputeDlg();
236 QFrame* createMainFrame( QWidget*, bool );
239 QGroupBox* myMemoryLackGroup;
240 QGroupBox* myCompErrorGroup;
241 QGroupBox* myHypErrorGroup;
242 QLabel* myHypErrorLabel;
243 QLabel* myWarningLabel;
244 QTableWidget* myTable;
245 QPushButton* myShowBtn;
246 QPushButton* myPublishBtn;
247 QPushButton* myBadMeshBtn;
248 QPushButton* myBadMeshToGroupBtn;
250 SMESHGUI_MeshInfosBox* myBriefInfo;
251 SMESHGUI_MeshInfosBox* myFullInfo;
253 friend class SMESHGUI_BaseComputeOp;
254 friend class SMESHGUI_PrecomputeOp;
255 friend class SMESHGUI_ShowErrorsOp;
258 class SMESHGUI_MeshOrderBox;
261 * \brief Dialog to preview and compute a mesh and show computation errors
264 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
269 SMESHGUI_PrecomputeDlg( QWidget* );
270 virtual ~SMESHGUI_PrecomputeDlg();
272 void setPreviewModes( const QList<int>& );
273 int getPreviewMode() const;
275 SMESHGUI_MeshOrderBox* getMeshOrderBox() const;
281 SMESHGUI_MeshOrderBox* myOrderBox;
282 QPushButton* myPreviewBtn;
283 QtxComboBox* myPreviewMode;
287 * \brief Thread to launch computation
290 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThread : public QThread
295 SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var gen,
296 SMESH::SMESH_Mesh_var mesh,
297 GEOM::GEOM_Object_var mainShape);
300 SMESH::SMESH_Mesh_var& getMesh() { return myMesh; }
306 SMESH::SMESH_Gen_var myGen;
307 SMESH::SMESH_Mesh_var myMesh;
308 GEOM::GEOM_Object_var myMainShape;
313 * \brief Dialog to display Cancel button
316 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThreadQDialog : public QDialog
321 SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent,
322 SMESH::SMESH_Gen_var gen,
323 SMESH::SMESH_Mesh_var mesh,
324 GEOM::GEOM_Object_var mainShape);
328 void timerEvent(QTimerEvent *timer);
329 void closeEvent(QCloseEvent *event);
335 SMESHGUI_ComputeDlg_QThread qthread;
336 QPushButton * cancelButton;
337 QLabel * nbNodesLabel;
338 QLabel * nbElemsLabel;
339 QLabel * freeRAMLabel;
340 QProgressBar* progressBar;
343 #endif // SMESHGUI_COMPUTEDLG_H