1 // Copyright (C) 2007-2021 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, 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;
100 virtual bool onApply();
101 void onPreviewShape();
102 void onPublishShape();
103 void onShowBadMesh();
104 void onGroupOfBadMesh();
105 void currentCellChanged();
108 QTableWidget* table();
111 QPointer<SMESHGUI_ComputeDlg> myCompDlg;
114 SMESH::SMESH_Mesh_var myMesh;
115 GEOM::GEOM_Object_var myMainShape;
116 GEOM::GEOM_Object_var myCurShape;
117 SMESH::TShapeDisplayer* myTShapeDisplayer;
118 SMESHGUI_MeshEditPreview* myBadMeshDisplayer;
119 Handle(SALOME_InteractiveObject) myIObject;
123 * \brief Operation to compute a mesh and show computation errors
125 class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
130 SMESHGUI_ComputeOp();
131 virtual ~SMESHGUI_ComputeOp();
133 virtual LightApp_Dialog* dlg() const;
136 virtual void startOperation();
141 class SMESHGUI_MeshOrderMgr;
144 * \brief Operation to preview and compute a mesh and show computation errors
146 class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
151 SMESHGUI_PrecomputeOp();
152 virtual ~SMESHGUI_PrecomputeOp();
154 virtual LightApp_Dialog* dlg() const;
157 * \brief returns map of assigned algorithms modes
159 static void getAssignedAlgos(_PTR(SObject) theMesh,
160 QMap<int,int>& theModeMap);
163 virtual void startOperation();
164 virtual void stopOperation();
165 virtual void resumeOperation();
167 virtual void initDialog();
170 virtual void onCancel();
178 QMap< int, int > myMapShapeId;
179 QPointer<LightApp_Dialog> myActiveDlg;
180 QPointer<SMESHGUI_PrecomputeDlg> myDlg;
181 SMESHGUI_MeshEditPreview* myPreviewDisplayer;
182 //! fields for mesh order
183 typedef QList<int> TListOfInt;
184 typedef QList<TListOfInt> TListOfListOfInt;
185 TListOfListOfInt myPrevOrder;
186 SMESHGUI_MeshOrderMgr* myOrderMgr;
190 * \brief Operation to evaluate a mesh and show result
192 class SMESHGUI_EXPORT SMESHGUI_EvaluateOp: public SMESHGUI_BaseComputeOp
197 SMESHGUI_EvaluateOp();
198 virtual ~SMESHGUI_EvaluateOp();
200 virtual LightApp_Dialog* dlg() const;
203 virtual void startOperation();
209 * \brief Operation to show meshing errors
211 class SMESHGUI_EXPORT SMESHGUI_ShowErrorsOp: public SMESHGUI_BaseComputeOp
216 SMESHGUI_ShowErrorsOp();
219 virtual void startOperation();
223 * \brief Dialog to compute a mesh and show computation errors
226 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
231 SMESHGUI_ComputeDlg( QWidget*, bool );
232 virtual ~SMESHGUI_ComputeDlg();
235 QFrame* createMainFrame( QWidget*, bool );
238 QGroupBox* myMemoryLackGroup;
239 QGroupBox* myCompErrorGroup;
240 QGroupBox* myHypErrorGroup;
241 QLabel* myHypErrorLabel;
242 QLabel* myWarningLabel;
243 QTableWidget* myTable;
244 QPushButton* myShowBtn;
245 QPushButton* myPublishBtn;
246 QPushButton* myBadMeshBtn;
247 QPushButton* myBadMeshToGroupBtn;
249 SMESHGUI_MeshInfosBox* myBriefInfo;
250 SMESHGUI_MeshInfosBox* myFullInfo;
252 friend class SMESHGUI_BaseComputeOp;
253 friend class SMESHGUI_PrecomputeOp;
254 friend class SMESHGUI_ShowErrorsOp;
257 class SMESHGUI_MeshOrderBox;
260 * \brief Dialog to preview and compute a mesh and show computation errors
263 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
268 SMESHGUI_PrecomputeDlg( QWidget* );
269 virtual ~SMESHGUI_PrecomputeDlg();
271 void setPreviewModes( const QList<int>& );
272 int getPreviewMode() const;
274 SMESHGUI_MeshOrderBox* getMeshOrderBox() const;
280 SMESHGUI_MeshOrderBox* myOrderBox;
281 QPushButton* myPreviewBtn;
282 QtxComboBox* myPreviewMode;
286 * \brief Thread to launch computation
289 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThread : public QThread
294 SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var gen,
295 SMESH::SMESH_Mesh_var mesh,
296 GEOM::GEOM_Object_var mainShape);
299 SMESH::SMESH_Mesh_var& getMesh() { return myMesh; }
305 SMESH::SMESH_Gen_var myGen;
306 SMESH::SMESH_Mesh_var myMesh;
307 GEOM::GEOM_Object_var myMainShape;
312 * \brief Dialog to display Cancel button
315 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThreadQDialog : public QDialog
320 SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent,
321 SMESH::SMESH_Gen_var gen,
322 SMESH::SMESH_Mesh_var mesh,
323 GEOM::GEOM_Object_var mainShape);
327 void timerEvent(QTimerEvent *timer);
328 void closeEvent(QCloseEvent *event);
334 SMESHGUI_ComputeDlg_QThread qthread;
335 QPushButton * cancelButton;
336 QLabel * nbNodesLabel;
337 QLabel * nbElemsLabel;
338 QLabel * freeRAMLabel;
339 QProgressBar* progressBar;
342 #endif // SMESHGUI_COMPUTEDLG_H