Back to index

salome-smesh  6.5.0
SMESHGUI_MeshOp.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // SMESH SMESHGUI : GUI for SMESH component
00024 // File   : SMESHGUI_MeshOp.h
00025 // Author : Sergey LITONIN, Open CASCADE S.A.S.
00026 //
00027 #ifndef SMESHGUI_MESHOP_H
00028 #define SMESHGUI_MESHOP_H
00029 
00030 // SMESH includes
00031 #include "SMESH_SMESHGUI.hxx"
00032 
00033 #include "SMESHGUI_SelectionOp.h"
00034 
00035 class HypothesesSet;
00036 class SMESHGUI_MeshDlg;
00037 class SMESHGUI_ShapeByMeshOp;
00038 class HypothesisData;
00039 
00045 class SMESHGUI_EXPORT SMESHGUI_MeshOp : public SMESHGUI_SelectionOp
00046 { 
00047   Q_OBJECT
00048       
00049 public:
00050   enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes };
00051 
00052   typedef std::pair<SMESH::SMESH_Hypothesis_var, QString> THypItem;
00053   typedef QList< THypItem > THypList;
00054 
00055   typedef int THypType;
00056   typedef QMap< THypType, THypList > TType2HypList;
00057 
00058   typedef int THypDim;
00059   typedef QMap< THypDim, TType2HypList > TDim2Type2HypList;
00060 
00061 public:
00062   SMESHGUI_MeshOp( const bool, const bool = true );
00063   virtual ~SMESHGUI_MeshOp();
00064   
00065   virtual LightApp_Dialog*       dlg() const;  
00066 
00067 protected:
00068   virtual void                   startOperation();
00069   virtual void                   commitOperation();
00070   virtual void                   selectionDone();
00071   virtual SUIT_SelectionFilter*  createFilter( const int ) const;
00072   virtual bool                   isValid( SUIT_Operation* ) const;
00073 
00074 protected slots:
00075   virtual bool                   onApply();
00076   void                           onCreateHyp( const int, const int );
00077   void                           onEditHyp( const int, const int );
00078   void                           onHypoSet( const QString& );
00079   void                           onGeomSelectionByMesh( bool );
00080   void                           onPublishShapeByMeshDlg( SUIT_Operation* );
00081   void                           onCloseShapeByMeshDlg( SUIT_Operation* );
00082   void                           onAlgoSelected( const int, const int = -1 );
00083   void                           processSet();
00084   void                           onHypoCreated( int );
00085   void                           onHypoEdited( int );
00086 
00087 private:
00088   typedef QList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
00089 
00090   bool                           isValid( QString& ) const;
00091   void                           availableHyps( const int, 
00092                                                 const int,
00093                                                 QStringList&,
00094                                                 THypDataList&,
00095                                                 HypothesisData* = 0 ) const;
00096   static void                    existingHyps( const int, 
00097                                                const int, 
00098                                                _PTR(SObject),
00099                                                QStringList&, 
00100                                                THypList&,
00101                                                HypothesisData* = 0 );
00102   HypothesisData*                hypData( const int,
00103                                           const int,
00104                                           const int ); // access to myAvailableHypData
00105 
00106   void                           createHypothesis( const int, const int,
00107                                                    const QString& );
00108 
00109   bool                           createMesh( QString&, QStringList& );
00110   bool                           createSubMesh( QString&, QStringList& );
00111   bool                           editMeshOrSubMesh( QString& );
00112 
00113   int                            currentHyp( const int, const int ) const;
00114   bool                           isAccessibleDim( const int ) const;
00115   void                           setCurrentHyp( const int, const int, const int );
00116   void                           setDefaultName() const;
00117   SMESH::SMESH_Hypothesis_var    getAlgo( const int );
00118   void                           readMesh();
00119   QString                        name( _PTR(SObject) ) const;
00120   int                            find( const SMESH::SMESH_Hypothesis_var&,
00121                                        const THypList& ) const;
00122   SMESH::SMESH_Hypothesis_var    getInitParamsHypothesis( const QString&,
00123                                                           const QString& ) const;
00124   bool                           isSubshapeOk() const;
00125   char*                          isSubmeshIgnored() const;
00126   _PTR(SObject)                  getSubmeshByGeom() const;
00127   void                           selectObject( _PTR(SObject) ) const;
00128 
00129 private:
00130   SMESHGUI_MeshDlg*              myDlg;
00131   SMESHGUI_ShapeByMeshOp*        myShapeByMeshOp;
00132   bool                           myToCreate;
00133   bool                           myIsMesh;
00134   bool                           myIsOnGeometry; 
00135 
00136   TDim2Type2HypList              myExistingHyps; 
00137   TDim2Type2HypList              myObjHyps;      
00138                                                  //   edited mesh/sub-mesh
00139 
00140   // hypdata corresponding to hypotheses present in myDlg
00141   THypDataList                   myAvailableHypData[4][NbHypTypes];
00142 
00143   bool                           myIgnoreAlgoSelection;
00144   HypothesesSet* myHypoSet;
00145   int myDim, myType;
00146 
00147   QString                        myObjectToSelect;
00148 };
00149 
00150 #endif // SMESHGUI_MESHOP_H