1 // Copyright (C) 2007-2011 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 currentCellChanged();
105 QTableWidget* table();
108 QPointer<SMESHGUI_ComputeDlg> myCompDlg;
111 SMESH::SMESH_Mesh_var myMesh;
112 GEOM::GEOM_Object_var myMainShape;
113 SMESH::TShapeDisplayer* myTShapeDisplayer;
114 SMESHGUI_MeshEditPreview* myBadMeshDisplayer;
115 Handle(SALOME_InteractiveObject) myIObject;
119 * \brief Operation to compute a mesh and show computation errors
121 class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
126 SMESHGUI_ComputeOp();
127 virtual ~SMESHGUI_ComputeOp();
129 virtual LightApp_Dialog* dlg() const;
132 virtual void startOperation();
137 class SMESHGUI_MeshOrderMgr;
140 * \brief Operation to preview and compute a mesh and show computation errors
142 class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
147 SMESHGUI_PrecomputeOp();
148 virtual ~SMESHGUI_PrecomputeOp();
150 virtual LightApp_Dialog* dlg() const;
153 * \brief returns map of assigned algorithms modes
155 static void getAssignedAlgos(_PTR(SObject) theMesh,
156 QMap<int,int>& theModeMap);
159 virtual void startOperation();
160 virtual void stopOperation();
161 virtual void resumeOperation();
163 virtual void initDialog();
166 virtual void onCancel();
174 QMap< int, int > myMapShapeId;
175 QPointer<LightApp_Dialog> myActiveDlg;
176 QPointer<SMESHGUI_PrecomputeDlg> myDlg;
177 SMESHGUI_MeshEditPreview* myPreviewDisplayer;
178 //! fields for mesh order
179 typedef QList<int> TListOfInt;
180 typedef QList<TListOfInt> TListOfListOfInt;
181 TListOfListOfInt myPrevOrder;
182 SMESHGUI_MeshOrderMgr* myOrderMgr;
186 * \brief Operation to evaluate a mesh and show result
188 class SMESHGUI_EXPORT SMESHGUI_EvaluateOp: public SMESHGUI_BaseComputeOp
193 SMESHGUI_EvaluateOp();
194 virtual ~SMESHGUI_EvaluateOp();
196 virtual LightApp_Dialog* dlg() const;
199 virtual void startOperation();
205 * \brief Dialog to compute a mesh and show computation errors
208 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
213 SMESHGUI_ComputeDlg( QWidget*, bool );
214 virtual ~SMESHGUI_ComputeDlg();
217 QFrame* createMainFrame( QWidget*, bool );
220 QGroupBox* myMemoryLackGroup;
221 QGroupBox* myCompErrorGroup;
222 QGroupBox* myHypErrorGroup;
223 QLabel* myHypErrorLabel;
224 QLabel* myWarningLabel;
225 QTableWidget* myTable;
226 QPushButton* myShowBtn;
227 QPushButton* myPublishBtn;
228 QPushButton* myBadMeshBtn;
230 SMESHGUI_MeshInfosBox* myBriefInfo;
231 SMESHGUI_MeshInfosBox* myFullInfo;
233 friend class SMESHGUI_BaseComputeOp;
234 friend class SMESHGUI_PrecomputeOp;
237 class SMESHGUI_MeshOrderBox;
240 * \brief Dialog to preview and compute a mesh and show computation errors
243 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
248 SMESHGUI_PrecomputeDlg( QWidget* );
249 virtual ~SMESHGUI_PrecomputeDlg();
251 void setPreviewModes( const QList<int>& );
252 int getPreviewMode() const;
254 SMESHGUI_MeshOrderBox* getMeshOrderBox() const;
260 SMESHGUI_MeshOrderBox* myOrderBox;
261 QPushButton* myPreviewBtn;
262 QtxComboBox* myPreviewMode;
266 * \brief Thread to launch computation
269 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThread : public QThread
274 SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var gen,
275 SMESH::SMESH_Mesh_var mesh,
276 GEOM::GEOM_Object_var mainShape);
284 SMESH::SMESH_Gen_var myGen;
285 SMESH::SMESH_Mesh_var myMesh;
286 GEOM::GEOM_Object_var myMainShape;
291 * \brief Dialog to display Cancel button
294 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThreadQDialog : public QDialog
299 SMESHGUI_ComputeDlg_QThreadQDialog(QWidget *parent,
300 SMESH::SMESH_Gen_var gen,
301 SMESH::SMESH_Mesh_var mesh,
302 GEOM::GEOM_Object_var mainShape);
306 void timerEvent(QTimerEvent *timer);
307 void closeEvent(QCloseEvent *event);
313 SMESHGUI_ComputeDlg_QThread qthread;
314 QPushButton *cancelButton;
318 #endif // SMESHGUI_COMPUTEDLG_H