Version: 6.3.1

src/SMESHGUI/SMESHGUI_ComputeDlg.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File   : SMESHGUI_ComputeDlg.h
00021 // Author : Edward AGAPOV, Open CASCADE S.A.S.
00022 //
00023 #ifndef SMESHGUI_COMPUTEDLG_H
00024 #define SMESHGUI_COMPUTEDLG_H
00025 
00026 // SMESH includes
00027 #include "SMESH_SMESHGUI.hxx"
00028 
00029 #include "SMESHGUI_Dialog.h"
00030 #include "SMESHGUI_Operation.h"
00031 
00032 // SALOME GUI includes
00033 #include <SALOME_InteractiveObject.hxx>
00034 
00035 // Qt includes
00036 #include <QMap>
00037 #include <QList>
00038 #include <QPointer>
00039 #include <QGroupBox>
00040 #include <QThread>
00041 
00042 // IDL includes
00043 #include <SALOMEconfig.h>
00044 #include CORBA_SERVER_HEADER(SMESH_Gen)
00045 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00046 
00047 class QFrame;
00048 class QPushButton;
00049 class QTableWidget;
00050 class QLabel;
00051 class QtxComboBox;
00052 class SMESHGUI_ComputeDlg;
00053 class SMESHGUI_MeshInfosBox;
00054 class SMESHGUI_PrecomputeDlg;
00055 class SMESHGUI_MeshEditPreview;
00056 
00057 namespace SMESH
00058 {
00059   class TShapeDisplayer;
00060 }
00061 
00065 class SMESHGUI_EXPORT SMESHGUI_BaseComputeOp: public SMESHGUI_Operation
00066 {
00067   Q_OBJECT
00068 
00069 public:
00070   SMESHGUI_BaseComputeOp();
00071   virtual ~SMESHGUI_BaseComputeOp();
00072 
00073   SMESH::SMESH_Mesh_ptr          getMesh();
00074 
00075 protected:
00076   virtual void                   startOperation();
00077   virtual void                   stopOperation();
00078 
00079   SMESHGUI_ComputeDlg*           computeDlg() const;
00080   void                           computeMesh();
00081   void                           showComputeResult( const bool,
00082                                                     const bool,
00083                                                     SMESH::compute_error_array_var&,
00084                                                     const bool,
00085                                                     const QString& );
00086   SMESHGUI_ComputeDlg*           evaluateDlg() const;
00087   void                           evaluateMesh();
00088   void                           showEvaluateResult(const SMESH::long_array& theRes,
00089                                                     const bool,
00090                                                     const bool,
00091                                                     SMESH::compute_error_array_var&,
00092                                                     const bool,
00093                                                     const QString&);
00094 
00095   virtual bool                   isValid( SUIT_Operation* theOp ) const;
00096     
00097 protected slots:
00098   virtual bool                   onApply();
00099   void                           onPreviewShape();
00100   void                           onPublishShape();
00101   void                           onShowBadMesh();
00102   void                           currentCellChanged();
00103 
00104 private:
00105   QTableWidget*                  table();
00106 
00107 private:
00108   QPointer<SMESHGUI_ComputeDlg>  myCompDlg;
00109 
00110 protected:
00111   SMESH::SMESH_Mesh_var            myMesh;
00112   GEOM::GEOM_Object_var            myMainShape;
00113   SMESH::TShapeDisplayer*          myTShapeDisplayer;
00114   SMESHGUI_MeshEditPreview*        myBadMeshDisplayer;
00115   Handle(SALOME_InteractiveObject) myIObject;
00116 };
00117 
00121 class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
00122 {
00123   Q_OBJECT
00124 
00125 public:
00126   SMESHGUI_ComputeOp();
00127   virtual ~SMESHGUI_ComputeOp();
00128 
00129   virtual LightApp_Dialog*       dlg() const;
00130 
00131 protected:
00132   virtual void                   startOperation();
00133 
00134 protected slots:
00135 };
00136 
00137 class SMESHGUI_MeshOrderMgr;
00138 
00142 class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
00143 {
00144   Q_OBJECT
00145 
00146 public:
00147   SMESHGUI_PrecomputeOp();
00148   virtual ~SMESHGUI_PrecomputeOp();
00149 
00150   virtual LightApp_Dialog*       dlg() const;
00151 
00155   static void                    getAssignedAlgos(_PTR(SObject) theMesh,
00156                                                   QMap<int,int>& theModeMap);
00157 
00158 protected:
00159   virtual void                   startOperation();
00160   virtual void                   stopOperation();
00161   virtual void                   resumeOperation();
00162 
00163   virtual void                   initDialog();
00164 
00165 protected slots:
00166   virtual void                   onCancel();
00167 
00168 private slots:
00169   void                           onPreview();
00170   void                           onCompute();
00171 
00172 private:
00174   QMap< int, int >               myMapShapeId;
00175   QPointer<LightApp_Dialog>      myActiveDlg;
00176   QPointer<SMESHGUI_PrecomputeDlg> myDlg;
00177   SMESHGUI_MeshEditPreview*      myPreviewDisplayer;
00179   typedef QList<int>             TListOfInt;
00180   typedef QList<TListOfInt>      TListOfListOfInt;
00181   TListOfListOfInt               myPrevOrder;
00182   SMESHGUI_MeshOrderMgr*         myOrderMgr;
00183 };
00184 
00188 class SMESHGUI_EXPORT SMESHGUI_EvaluateOp: public SMESHGUI_BaseComputeOp
00189 {
00190   Q_OBJECT
00191 
00192 public:
00193   SMESHGUI_EvaluateOp();
00194   virtual ~SMESHGUI_EvaluateOp();
00195 
00196   virtual LightApp_Dialog*       dlg() const;
00197 
00198 protected:
00199   virtual void                   startOperation();
00200 
00201 protected slots:
00202 };
00203 
00208 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
00209 {
00210   Q_OBJECT
00211 
00212 public:
00213   SMESHGUI_ComputeDlg( QWidget*, bool );
00214   virtual ~SMESHGUI_ComputeDlg();
00215 
00216 protected:
00217   QFrame*                      createMainFrame( QWidget*, bool );
00218 
00219   QLabel*                      myMeshName;
00220   QGroupBox*                   myMemoryLackGroup;
00221   QGroupBox*                   myCompErrorGroup;
00222   QGroupBox*                   myHypErrorGroup;
00223   QLabel*                      myHypErrorLabel;
00224   QTableWidget*                myTable;
00225   QPushButton*                 myShowBtn;
00226   QPushButton*                 myPublishBtn;
00227   QPushButton*                 myBadMeshBtn;
00228 
00229   SMESHGUI_MeshInfosBox*       myBriefInfo;
00230   SMESHGUI_MeshInfosBox*       myFullInfo;
00231 
00232   friend class SMESHGUI_BaseComputeOp;
00233   friend class SMESHGUI_PrecomputeOp;
00234 };
00235 
00236 class SMESHGUI_MeshOrderBox;
00237 
00242 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
00243 {
00244   Q_OBJECT
00245 
00246 public:
00247   SMESHGUI_PrecomputeDlg( QWidget* );
00248   virtual ~SMESHGUI_PrecomputeDlg();
00249   
00250   void                         setPreviewModes( const QList<int>& );
00251   int                          getPreviewMode() const;
00252   
00253   SMESHGUI_MeshOrderBox*       getMeshOrderBox() const;
00254 
00255 signals:
00256   void                         preview();
00257 
00258 private:
00259   SMESHGUI_MeshOrderBox*       myOrderBox;
00260   QPushButton*                 myPreviewBtn;
00261   QtxComboBox*                 myPreviewMode;
00262 };
00263 
00268 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThread : public QThread
00269 {
00270   Q_OBJECT
00271     
00272 public:
00273   SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var gen,
00274                               SMESH::SMESH_Mesh_var mesh,
00275                               GEOM::GEOM_Object_var mainShape);
00276   bool result();
00277   void cancel();
00278   
00279 protected:
00280   void run();
00281   
00282 private:
00283   SMESH::SMESH_Gen_var myGen;
00284   SMESH::SMESH_Mesh_var myMesh;
00285   GEOM::GEOM_Object_var myMainShape;
00286   bool myResult;
00287 };
00288 
00293 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThreadQDialog : public QDialog
00294 {
00295   Q_OBJECT
00296     
00297 public:
00298   SMESHGUI_ComputeDlg_QThreadQDialog(QWidget *parent,
00299                                      SMESH::SMESH_Gen_var gen,
00300                                      SMESH::SMESH_Mesh_var mesh,
00301                                      GEOM::GEOM_Object_var mainShape);
00302   bool result();
00303   
00304 protected:
00305   void timerEvent(QTimerEvent *timer);
00306   void closeEvent(QCloseEvent *event);
00307   
00308 private slots:
00309   void onCancel();
00310   
00311 private:
00312   SMESHGUI_ComputeDlg_QThread qthread;
00313   QPushButton *cancelButton;
00314   
00315 };
00316 
00317 #endif // SMESHGUI_COMPUTEDLG_H
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS