Salome HOME
0020746: EDF 1274 SMESH : MergeAllNodesButNodesFromGroup feature
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MergeDlg.h
1 //  Copyright (C) 2007-2010  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
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File   : SMESHGUI_MergeDlg.h
25 // Author : Open CASCADE S.A.S.
26 //
27 #ifndef SMESHGUI_MergeDlg_H
28 #define SMESHGUI_MergeDlg_H
29
30 // SMESH includes
31 #include "SMESH_SMESHGUI.hxx"
32
33 // Qt includes
34 #include <QDialog>
35
36 // OCCT includes
37 #include <gp_XYZ.hxx>
38
39 // STL includes
40 #include <list>
41
42 // IDL includes
43 #include <SALOMEconfig.h>
44 #include CORBA_SERVER_HEADER(SMESH_Mesh)
45
46 class QGroupBox;
47 class QLabel;
48 class QLineEdit;
49 class QPushButton;
50 class QRadioButton;
51 class QCheckBox;
52 class QListWidget;
53 class QButtonGroup;
54 class SMESHGUI;
55 class SMESHGUI_SpinBox;
56 class SMESH_Actor;
57 class SVTK_Selector;
58 class LightApp_SelectionMgr;
59 class SUIT_SelectionFilter;
60 class TColStd_MapOfInteger;
61
62 namespace SMESH
63 {
64   struct TIdPreview;
65 }
66
67 //=================================================================================
68 // class    : SMESHGUI_MergeDlg
69 // purpose  : 
70 //=================================================================================
71 class SMESHGUI_EXPORT SMESHGUI_MergeDlg : public QDialog
72 {
73   Q_OBJECT;
74
75 public:
76   SMESHGUI_MergeDlg( SMESHGUI*, int );
77   ~SMESHGUI_MergeDlg();
78
79 private:
80   void                      Init();
81   void                      closeEvent( QCloseEvent* );
82   void                      enterEvent( QEvent* );              /* mouse enter the QWidget */
83   void                      hideEvent( QHideEvent* );           /* ESC key */
84   void                      keyPressEvent( QKeyEvent* );
85   void                      onEditGroup();
86
87   void                      FindGravityCenter( TColStd_MapOfInteger&, 
88                                                std::list<gp_XYZ>& );
89   // add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list
90
91 private:
92   typedef QList<SMESH::SMESH_GroupBase_var> GrpList;
93
94   SMESHGUI*                 mySMESHGUI;     /* Current SMESHGUI object */
95   LightApp_SelectionMgr*    mySelectionMgr; /* User shape selection */
96   SVTK_Selector*            mySelector;
97   
98   QWidget*                  myEditCurrentArgument;
99
100   SMESH::SMESH_Mesh_var     myMesh;
101   SMESH::SMESH_IDSource_var mySubMeshOrGroup;
102   SMESH_Actor*              myActor;
103   SUIT_SelectionFilter*     myMeshOrSubMeshOrGroupFilter;
104
105   SMESH::TIdPreview*        myIdPreview;
106
107   int                       myAction;
108   bool                      myIsBusy;
109   int                       myTypeId;
110
111   // Widgets
112   QGroupBox*                GroupConstructors;
113   QRadioButton*             RadioButton;
114
115   QGroupBox*                GroupButtons;
116   QPushButton*              buttonOk;
117   QPushButton*              buttonCancel;
118   QPushButton*              buttonApply;
119   QPushButton*              buttonHelp;
120
121   QGroupBox*                GroupMesh;
122   QLabel*                   TextLabelName;
123   QPushButton*              SelectMeshButton;
124   QLineEdit*                LineEditMesh;
125
126   QGroupBox*                GroupCoincident;
127   QWidget*                  GroupCoincidentWidget;
128   QLabel*                   TextLabelTolerance;
129   SMESHGUI_SpinBox*         SpinBoxTolerance;
130   QPushButton*              DetectButton;
131   QListWidget*              ListCoincident;
132   QPushButton*              AddGroupButton;
133   QPushButton*              RemoveGroupButton;
134   QCheckBox*                SelectAllCB;
135
136   QGroupBox*                GroupEdit;
137   QListWidget*              ListEdit;
138   QPushButton*              AddElemButton;
139   QPushButton*              RemoveElemButton;
140   QPushButton*              SetFirstButton;
141
142   QGroupBox*                GroupExclude;
143   QListWidget*              ListExclude;
144
145   QGroupBox*                TypeBox;
146   QButtonGroup*             GroupType;
147     
148   QString                   myHelpFileName;
149
150   QString                   myEntry;
151   GrpList                   myGroups;
152
153  private slots:
154   void                      ClickOnOk();
155   void                      ClickOnCancel();
156   bool                      ClickOnApply();
157   void                      ClickOnHelp();
158   void                      updateControls();
159   void                      onDetect();
160   void                      onAddGroup();
161   void                      onRemoveGroup();
162   void                      onSelectGroup();
163   void                      onSelectAll( bool );
164   void                      onSelectElementFromGroup();
165   void                      onAddElement();
166   void                      onRemoveElement();
167   void                      onSetFirst();
168   void                      SetEditCurrentArgument();
169   void                      SelectionIntoArgument();
170   void                      DeactivateActiveDialog();
171   void                      ActivateThisDialog();
172   void                      onTypeChanged(int);
173 };
174
175 #endif // SMESHGUI_MergeDlg_H