Salome HOME
f49abb6bf60cc405ccf58eb84d2e392b39c2c75b
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ShapeByMeshDlg.h
1 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
8 //
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 // File   : SMESHGUI_ShapeByMeshDlg.h
21 // Author : Edward AGAPOV, Open CASCADE S.A.S.
22 //
23
24 #ifndef SMESHGUI_SHAPEBYMESHDLG_H
25 #define SMESHGUI_SHAPEBYMESHDLG_H
26
27 // SMESH includes
28 #include "SMESH_SMESHGUI.hxx"
29
30 #include "SMESHGUI_Dialog.h"
31 #include "SMESHGUI_SelectionOp.h"
32
33 // IDL includes
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(SMESH_Mesh)
36
37 class QFrame;
38 class QLineEdit;
39 class QButtonGroup;
40 class QGroupBox;
41
42 /*!
43  * \brief Dialog to publish a sub-shape of the mesh main shape
44  *        by selecting mesh elements
45  */
46
47 class SMESHGUI_EXPORT SMESHGUI_ShapeByMeshDlg : public SMESHGUI_Dialog
48 {
49   Q_OBJECT
50
51 public:
52   SMESHGUI_ShapeByMeshDlg();
53   virtual ~SMESHGUI_ShapeByMeshDlg();
54
55 private:
56   QFrame*                  createMainFrame( QWidget* );
57
58   QGroupBox*               myElemTypeBox;
59   QButtonGroup*            myElemTypeGroup;
60   QLineEdit*               myElementId;
61   QLineEdit*               myGeomName;
62
63   bool                     myIsMultipleAllowed;
64   void                     setMultipleAllowed( bool );
65
66   friend class SMESHGUI_ShapeByMeshOp;
67 };
68
69 /*!
70  * \brief Operation to publish a sub-shape of the mesh main shape
71  *        by selecting mesh elements
72  */
73 class SMESHGUI_ShapeByMeshOp: public SMESHGUI_SelectionOp
74 {
75   Q_OBJECT
76
77 public:
78   SMESHGUI_ShapeByMeshOp( bool = false );
79   virtual ~SMESHGUI_ShapeByMeshOp();
80
81   virtual LightApp_Dialog* dlg() const;  
82
83   void                     Init();
84   void                     SetMesh( SMESH::SMESH_Mesh_ptr );
85   SMESH::SMESH_Mesh_ptr    GetMesh();
86   GEOM::GEOM_Object_ptr    GetShape();
87
88 protected:
89   virtual void             commitOperation();
90   virtual void             startOperation();
91
92   void                     activateSelection();
93   void                     setElementID( const QString& );
94
95 protected slots:
96   virtual bool             onApply();
97
98 private slots:
99   void                     onSelectionDone();
100   void                     onTypeChanged( int );
101   void                     onElemIdChanged( const QString& );
102
103 private:
104   SMESHGUI_ShapeByMeshDlg* myDlg;
105   SMESH::SMESH_Mesh_var    myMesh;
106   GEOM::GEOM_Object_var    myGeomObj;
107
108   bool                     myIsManualIdEnter;
109   bool                     myHasSolids;
110   bool                     myIsMultipleAllowed;
111 };
112
113 #endif