]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_MeshOp.h
Salome HOME
PAL15429 Computation of the mesh, based on "014.brep" via Tetrahedron(NETGEN), is...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshOp.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 /**
23 *  SMESH SMESHGUI
24 *
25 *  Copyright (C) 2005  CEA/DEN, EDF R&D
26 *
27 *
28 *
29 *  File   : SMESHGUI_MeshOp.h
30 *  Author : Sergey LITONIN
31 *  Module : SMESHGUI
32 */
33
34 #ifndef SMESHGUI_MeshOp_H
35 #define SMESHGUI_MeshOp_H
36
37 #include "SMESH_SMESHGUI.hxx"
38
39 #include "SMESHGUI_SelectionOp.h"
40
41 #include <SALOMEconfig.h>
42 #include CORBA_CLIENT_HEADER(GEOM_Gen)
43 #include CORBA_CLIENT_HEADER(SMESH_Mesh)
44
45 #include <qstringlist.h>
46
47 class SMESHGUI_MeshDlg;
48 class SMESHGUI_ShapeByMeshOp;
49 class HypothesisData;
50
51 /*!
52  * \brief Operation for mech creation or editing
53  *
54  *  This operation is used for mech creation or editing. 
55 */
56 class SMESHGUI_EXPORT SMESHGUI_MeshOp : public SMESHGUI_SelectionOp
57
58   Q_OBJECT
59       
60 public:
61
62   enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes };
63
64   typedef std::pair<SMESH::SMESH_Hypothesis_var, QString> THypItem;
65   typedef QValueList< THypItem > THypList;
66
67   typedef int THypType;
68   typedef QMap< THypType, THypList > TType2HypList;
69
70   typedef int THypDim;
71   typedef QMap< THypDim, TType2HypList > TDim2Type2HypList;
72
73   SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh = true );
74   virtual ~SMESHGUI_MeshOp();
75   
76   virtual LightApp_Dialog*       dlg() const;  
77
78 protected:
79   virtual void                   startOperation();
80   virtual void                   selectionDone();
81   virtual SUIT_SelectionFilter*  createFilter( const int ) const;
82   virtual bool                   isValid( SUIT_Operation* ) const;
83
84 protected slots:
85   virtual bool                   onApply();
86   void                           onCreateHyp( const int theHypType, const int theIndex );
87   void                           onEditHyp( const int theHypType, const int theIndex );
88   void                           onHypoSet( const QString& theSetName );
89   void                           onGeomSelectionByMesh( bool );
90   void                           onPublishShapeByMeshDlg(SUIT_Operation*);
91   void                           onCloseShapeByMeshDlg(SUIT_Operation*);
92   void                           onAlgoSelected( const int theIndex,
93                                                  const int theDim = -1);
94
95 private:
96
97   typedef QValueList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
98
99   bool                           isValid( QString& ) const;
100   void                           availableHyps( const int       theDim, 
101                                                 const int       theHypType,
102                                                 QStringList&    theHyps,
103                                                 THypDataList&   theDataList,
104                                                 HypothesisData* theAlgoData = 0 ) const;
105   static void                    existingHyps( const int     theDim, 
106                                                const int     theHypType, 
107                                                _PTR(SObject) theFather,
108                                                QStringList&  theHyps, 
109                                                THypList& theHypList,
110                                                HypothesisData* theAlgoData = 0);
111   HypothesisData*                hypData( const int theDim,
112                                           const int theHypType,
113                                           const int theIndex); // access to myAvailableHypData
114
115   void                           createHypothesis(const int theDim, const int theType,
116                                                   const QString& theTypeName);
117
118   bool                           createMesh( QString& );
119   bool                           createSubMesh( QString& );
120   bool                           editMeshOrSubMesh( QString& );
121
122   int                            currentHyp( const int, const int ) const;
123   bool                           isAccessibleDim( const int ) const;
124   void                           setCurrentHyp( const int, const int, const int );
125   void                           setDefaultName() const;
126   SMESH::SMESH_Hypothesis_var    getAlgo( const int );
127   void                           readMesh();
128   QString                        name( _PTR(SObject) ) const;
129   int                            find( const SMESH::SMESH_Hypothesis_var&,
130                                        const THypList& theHypList) const;
131   SMESH::SMESH_Hypothesis_var    getInitParamsHypothesis( const QString& aHypType,
132                                                           const QString& aServerLib ) const;
133   bool                           isSubshapeOk() const;
134   char*                          isSubmeshIgnored() const;
135   _PTR(SObject)                  getSubmeshByGeom() const;
136   void                           selectObject( _PTR(SObject) ) const;
137
138 private:
139   SMESHGUI_MeshDlg*              myDlg;
140   SMESHGUI_ShapeByMeshOp*        myShapeByMeshOp;
141   bool                           myToCreate;
142   bool                           myIsMesh;
143   bool                           myIsOnGeometry; //!< TRUE if edited mesh accotiated with geometrical object
144
145   TDim2Type2HypList              myExistingHyps; //!< all hypothesis of SMESH module
146   TDim2Type2HypList              myObjHyps;      //!< hypothesis assigned to the current 
147                                                  //   edited mesh/sub-mesh
148
149   // hypdata corresponding to hypotheses present in myDlg
150   THypDataList                   myAvailableHypData[4][NbHypTypes];
151
152   bool                           myIgnoreAlgoSelection;
153 };
154
155 #endif