Salome HOME
IPAL21120 SIGSEGV on Meshing attached Compound with Automatic Hexadralization
[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
24 //  Module : SMESH
25 //
26 #ifndef SMESHGUI_ShapeByMeshDlg_H
27 #define SMESHGUI_ShapeByMeshDlg_H
28
29 #include "SMESH_SMESHGUI.hxx"
30
31 #include "SMESHGUI_Dialog.h"
32 #include "SMESHGUI_SelectionOp.h"
33
34 // IDL Headers
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(GEOM_Gen)
37 #include CORBA_SERVER_HEADER(SMESH_Mesh)
38
39 class QCloseEvent;
40 class QFrame;
41 class QLineEdit;
42 class QPushButton;
43 class LightApp_SelectionMgr;
44 class SVTK_ViewWindow;
45 class QButtonGroup;
46 class SMESHGUI;
47
48 /*!
49  * \brief Dialog to publish a sub-shape of the mesh main shape
50  *        by selecting mesh elements
51  */
52
53 class SMESHGUI_EXPORT SMESHGUI_ShapeByMeshDlg : public SMESHGUI_Dialog
54 {
55   Q_OBJECT
56
57 public:
58                            SMESHGUI_ShapeByMeshDlg();
59   virtual                  ~SMESHGUI_ShapeByMeshDlg();
60
61 private:
62
63   QFrame*                  createMainFrame   (QWidget*);
64
65   QButtonGroup*            myElemTypeGroup;
66   QLineEdit*               myElementId;
67   QLineEdit*               myGeomName;
68
69   bool                     myIsMultipleAllowed;
70   void                     setMultipleAllowed(bool isAllowed) {myIsMultipleAllowed = isAllowed;};
71
72   friend class SMESHGUI_ShapeByMeshOp;
73 };
74
75 /*!
76  * \brief Operation to publish a sub-shape of the mesh main shape
77  *        by selecting mesh elements
78  */
79 class SMESHGUI_ShapeByMeshOp: public SMESHGUI_SelectionOp
80 {
81   Q_OBJECT
82
83 public:
84   SMESHGUI_ShapeByMeshOp(bool isMultipleAllowed = false);
85   virtual ~SMESHGUI_ShapeByMeshOp();
86
87   virtual LightApp_Dialog*       dlg() const;  
88
89   void                     Init();
90   void                     SetMesh (SMESH::SMESH_Mesh_ptr);
91   SMESH::SMESH_Mesh_ptr    GetMesh () { return myMesh; }
92   GEOM::GEOM_Object_ptr    GetShape();
93
94 protected:
95
96   virtual void                   commitOperation();
97   virtual void                   startOperation();
98
99   void                     activateSelection();
100   void                     setElementID(const QString&);
101
102 protected slots:
103
104   virtual bool                   onApply() { return true; }
105
106 private slots:
107
108   void                     onSelectionDone();
109   void                     onTypeChanged (int);
110   void                     onElemIdChanged (const QString&);
111
112 private:
113
114   SMESHGUI_ShapeByMeshDlg* myDlg;
115   SMESH::SMESH_Mesh_var    myMesh;
116   GEOM::GEOM_Object_var    myGeomObj;
117
118   bool                     myIsManualIdEnter;
119   bool                     myHasSolids;
120   bool                     myIsMultipleAllowed;
121 };
122
123 #endif