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