Back to index

salome-smesh  6.5.0
SMESHGUI_ComputeDlg.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  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   QLabel*                      myWarningLabel;
00225   QTableWidget*                myTable;
00226   QPushButton*                 myShowBtn;
00227   QPushButton*                 myPublishBtn;
00228   QPushButton*                 myBadMeshBtn;
00229 
00230   SMESHGUI_MeshInfosBox*       myBriefInfo;
00231   SMESHGUI_MeshInfosBox*       myFullInfo;
00232 
00233   friend class SMESHGUI_BaseComputeOp;
00234   friend class SMESHGUI_PrecomputeOp;
00235 };
00236 
00237 class SMESHGUI_MeshOrderBox;
00238 
00243 class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
00244 {
00245   Q_OBJECT
00246 
00247 public:
00248   SMESHGUI_PrecomputeDlg( QWidget* );
00249   virtual ~SMESHGUI_PrecomputeDlg();
00250   
00251   void                         setPreviewModes( const QList<int>& );
00252   int                          getPreviewMode() const;
00253   
00254   SMESHGUI_MeshOrderBox*       getMeshOrderBox() const;
00255 
00256 signals:
00257   void                         preview();
00258 
00259 private:
00260   SMESHGUI_MeshOrderBox*       myOrderBox;
00261   QPushButton*                 myPreviewBtn;
00262   QtxComboBox*                 myPreviewMode;
00263 };
00264 
00269 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThread : public QThread
00270 {
00271   Q_OBJECT
00272     
00273 public:
00274   SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var gen,
00275                               SMESH::SMESH_Mesh_var mesh,
00276                               GEOM::GEOM_Object_var mainShape);
00277   bool result();
00278   void cancel();
00279   
00280 protected:
00281   void run();
00282   
00283 private:
00284   SMESH::SMESH_Gen_var myGen;
00285   SMESH::SMESH_Mesh_var myMesh;
00286   GEOM::GEOM_Object_var myMainShape;
00287   bool myResult;
00288 };
00289 
00294 class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThreadQDialog : public QDialog
00295 {
00296   Q_OBJECT
00297     
00298 public:
00299   SMESHGUI_ComputeDlg_QThreadQDialog(QWidget *parent,
00300                                      SMESH::SMESH_Gen_var gen,
00301                                      SMESH::SMESH_Mesh_var mesh,
00302                                      GEOM::GEOM_Object_var mainShape);
00303   bool result();
00304   
00305 protected:
00306   void timerEvent(QTimerEvent *timer);
00307   void closeEvent(QCloseEvent *event);
00308   
00309 private slots:
00310   void onCancel();
00311   
00312 private:
00313   SMESHGUI_ComputeDlg_QThread qthread;
00314   QPushButton *cancelButton;
00315   
00316 };
00317 
00318 #endif // SMESHGUI_COMPUTEDLG_H