Salome HOME
23617: EDF 14133 - Complete Merge Nodes / Merge Elements operations
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MergeDlg.h
1 // Copyright (C) 2007-2016  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 // 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 #include <TColStd_MapOfInteger.hxx>
39
40 // STL includes
41 #include <list>
42 #include <vector>
43
44 // IDL includes
45 #include <SALOMEconfig.h>
46 #include CORBA_SERVER_HEADER(SMESH_Mesh)
47
48 class LightApp_SelectionMgr;
49 class QButtonGroup;
50 class QCheckBox;
51 class QGroupBox;
52 class QLabel;
53 class QLineEdit;
54 class QListWidget;
55 class QPushButton;
56 class QRadioButton;
57 class SMESHGUI;
58 class SMESHGUI_IdPreview;
59 class SMESHGUI_SpinBox;
60 class SMESH_Actor;
61 class SUIT_SelectionFilter;
62 class SVTK_Selector;
63
64 namespace SMESH
65 {
66   struct TIdPreview;
67 }
68
69 //=================================================================================
70 // class    : SMESHGUI_MergeDlg
71 // purpose  : 
72 //=================================================================================
73 class SMESHGUI_EXPORT SMESHGUI_MergeDlg : public QDialog
74 {
75   Q_OBJECT;
76
77 public:
78   SMESHGUI_MergeDlg( SMESHGUI*, int );
79   ~SMESHGUI_MergeDlg();
80
81   static QPixmap IconFirst();
82
83 private:
84   void                      Init();
85   void                      enterEvent( QEvent* );              /* mouse enter the QWidget */
86   void                      keyPressEvent( QKeyEvent* );
87   void                      onEditGroup();
88   bool                      isKeepIDsSelection();
89   bool                      isNewKeepGroup( const char* entry );
90
91   void                      FindGravityCenter( TColStd_MapOfInteger&,
92                                                std::vector<int>& , 
93                                                std::list<gp_XYZ>& );
94   // add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list
95
96 private:
97   typedef QList<SMESH::SMESH_GroupBase_var> GrpList;
98
99   SMESHGUI*                  mySMESHGUI;     /* Current SMESHGUI object */
100   LightApp_SelectionMgr*     mySelectionMgr; /* User shape selection */
101   SVTK_Selector*             mySelector;
102   
103   QWidget*                   myEditCurrentArgument;
104
105   SMESH::SMESH_Mesh_var      myMesh;
106   SMESH::ListOfIDSources_var mySubMeshOrGroups;
107   GrpList                    myGroups;
108   QString                    myEntry;
109
110   SMESH_Actor*               myActor;
111   SUIT_SelectionFilter*      myMeshOrSubMeshOrGroupFilter;
112   SUIT_SelectionFilter*      mySubMeshOrGroupFilter;
113
114   SMESHGUI_IdPreview*        myIdPreview;
115   QString                    myHelpFileName;
116
117   int                        myAction;
118   bool                       myIsBusy;
119   int                        myTypeId; // manual(1) or automatic(0)
120     
121
122
123   // Widgets
124
125   QGroupBox*                GroupButtons;
126   QPushButton*              buttonOk;
127   QPushButton*              buttonCancel;
128   QPushButton*              buttonApply;
129   QPushButton*              buttonHelp;
130
131   QGroupBox*                GroupMesh;
132   QLabel*                   TextLabelName;
133   QPushButton*              SelectMeshButton;
134   QLineEdit*                LineEditMesh;
135
136   QWidget*                  NodeSpecWidget;
137   SMESHGUI_SpinBox*         SpinBoxTolerance;
138   QCheckBox*                SeparateCornersAndMedium;
139   QCheckBox*                AvoidMakingHoles;
140
141   QGroupBox*                GroupCoincident;
142   //QWidget*                  GroupCoincidentWidget;
143   QPushButton*              DetectButton;
144   QListWidget*              ListCoincident;
145   QPushButton*              AddGroupButton;
146   QPushButton*              RemoveGroupButton;
147   QCheckBox*                SelectAllCB;
148   QCheckBox*                ShowIDs;
149
150   QGroupBox*                GroupEdit;
151   QListWidget*              ListEdit;
152   QPushButton*              AddElemButton;
153   QPushButton*              RemoveElemButton;
154   QPushButton*              SetFirstButton;
155
156   QGroupBox*                GroupExclude;
157   QListWidget*              ListExclude;
158
159   QGroupBox*                GroupKeep;
160   QButtonGroup*             KeepFromButGroup;
161   QPushButton*              SelectKeepButton;
162   QPushButton*              AddKeepButton;
163   QPushButton*              RemoveKeepButton;
164   QListWidget*              KeepList;
165
166   QGroupBox*                TypeBox;
167   QButtonGroup*             GroupType;
168
169 protected slots:
170   virtual void              reject();
171
172  private slots:
173   void                      ClickOnOk();
174   bool                      ClickOnApply();
175   void                      ClickOnHelp();
176   void                      updateControls();
177   void                      onDetect();
178   void                      onAddKeep();
179   void                      onRemoveKeep();
180   void                      onSelectKeep();
181   void                      onKeepSourceChanged(int);
182   void                      onAddGroup();
183   void                      onRemoveGroup();
184   void                      onSelectGroup();
185   void                      onSelectAll( bool );
186   void                      onSelectElementFromGroup();
187   void                      onAddElement();
188   void                      onRemoveElement();
189   void                      onSetFirst();
190   void                      SetEditCurrentArgument();
191   void                      SelectionIntoArgument();
192   void                      DeactivateActiveDialog();
193   void                      ActivateThisDialog();
194   void                      onTypeChanged(int);
195   void                      onOpenView();
196   void                      onCloseView();
197 };
198
199 #endif // SMESHGUI_MergeDlg_H