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