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