Salome HOME
correct previous integration (Porting to Python 2.6)
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ShapeByMeshDlg.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 // File   : SMESHGUI_ShapeByMeshDlg.h
23 // Author : Edward AGAPOV, Open CASCADE S.A.S.
24 //
25 #ifndef SMESHGUI_SHAPEBYMESHDLG_H
26 #define SMESHGUI_SHAPEBYMESHDLG_H
27
28 // SMESH includes
29 #include "SMESH_SMESHGUI.hxx"
30
31 #include "SMESHGUI_Dialog.h"
32 #include "SMESHGUI_SelectionOp.h"
33
34 // IDL includes
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SMESH_Mesh)
37
38 class QFrame;
39 class QLineEdit;
40 class QButtonGroup;
41 class QGroupBox;
42
43 /*!
44  * \brief Dialog to publish a sub-shape of the mesh main shape
45  *        by selecting mesh elements
46  */
47
48 class SMESHGUI_EXPORT SMESHGUI_ShapeByMeshDlg : public SMESHGUI_Dialog
49 {
50   Q_OBJECT
51
52 public:
53   SMESHGUI_ShapeByMeshDlg();
54   virtual ~SMESHGUI_ShapeByMeshDlg();
55
56 private:
57   QFrame*                  createMainFrame( QWidget* );
58
59   QGroupBox*               myElemTypeBox;
60   QButtonGroup*            myElemTypeGroup;
61   QLineEdit*               myElementId;
62   QLineEdit*               myGeomName;
63
64   bool                     myIsMultipleAllowed;
65   void                     setMultipleAllowed( bool );
66
67   friend class SMESHGUI_ShapeByMeshOp;
68 };
69
70 /*!
71  * \brief Operation to publish a sub-shape of the mesh main shape
72  *        by selecting mesh elements
73  */
74 class SMESHGUI_ShapeByMeshOp: public SMESHGUI_SelectionOp
75 {
76   Q_OBJECT
77
78 public:
79   SMESHGUI_ShapeByMeshOp( bool = false );
80   virtual ~SMESHGUI_ShapeByMeshOp();
81
82   virtual LightApp_Dialog* dlg() const;  
83
84   void                     Init();
85   void                     SetMesh( SMESH::SMESH_Mesh_ptr );
86   SMESH::SMESH_Mesh_ptr    GetMesh();
87   GEOM::GEOM_Object_ptr    GetShape();
88
89 protected:
90   virtual void             commitOperation();
91   virtual void             startOperation();
92
93   void                     activateSelection();
94   void                     setElementID( const QString& );
95
96 protected slots:
97   virtual bool             onApply();
98
99 private slots:
100   void                     onSelectionDone();
101   void                     onTypeChanged( int );
102   void                     onElemIdChanged( const QString& );
103
104 private:
105   SMESHGUI_ShapeByMeshDlg* myDlg;
106   SMESH::SMESH_Mesh_var    myMesh;
107   GEOM::GEOM_Object_var    myGeomObj;
108
109   bool                     myIsManualIdEnter;
110   bool                     myHasSolids;
111   bool                     myIsMultipleAllowed;
112 };
113
114 #endif