Salome HOME
754dde0f0e87f469bbd4902da377f2c914a36e68
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MergeDlg.h
1 // Copyright (C) 2007-2015  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
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                      enterEvent( QEvent* );              /* mouse enter the QWidget */
82   void                      keyPressEvent( QKeyEvent* );
83   void                      onEditGroup();
84   bool                      isKeepNodesIDsSelection();
85   bool                      isNewKeepNodesGroup( const char* entry );
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   SUIT_SelectionFilter*     mySubMeshOrGroupFilter;
105
106   SMESH::TIdPreview*        myIdPreview;
107
108   int                       myAction;
109   bool                      myIsBusy;
110   int                       myTypeId; // manual(1) or automatic(0)
111
112   // Widgets
113   QGroupBox*                GroupConstructors;
114   QRadioButton*             RadioButton;
115
116   QGroupBox*                GroupButtons;
117   QPushButton*              buttonOk;
118   QPushButton*              buttonCancel;
119   QPushButton*              buttonApply;
120   QPushButton*              buttonHelp;
121
122   QGroupBox*                GroupMesh;
123   QLabel*                   TextLabelName;
124   QPushButton*              SelectMeshButton;
125   QLineEdit*                LineEditMesh;
126
127   QGroupBox*                GroupCoincident;
128   QWidget*                  GroupCoincidentWidget;
129   QLabel*                   TextLabelTolerance;
130   SMESHGUI_SpinBox*         SpinBoxTolerance;
131   QCheckBox*                SeparateCornersAndMedium;
132   QPushButton*              DetectButton;
133   QListWidget*              ListCoincident;
134   QPushButton*              AddGroupButton;
135   QPushButton*              RemoveGroupButton;
136   QCheckBox*                SelectAllCB;
137   QCheckBox*                ShowIDs;
138
139   QGroupBox*                GroupEdit;
140   QListWidget*              ListEdit;
141   QPushButton*              AddElemButton;
142   QPushButton*              RemoveElemButton;
143   QPushButton*              SetFirstButton;
144
145   QGroupBox*                GroupExclude;
146   QListWidget*              ListExclude;
147
148   QButtonGroup*             KeepFromButGroup;
149   QPushButton*              SelectKeepNodesButton;
150   QPushButton*              AddKeepNodesButton;
151   QPushButton*              RemoveKeepNodesButton;
152   QListWidget*              KeepList;
153
154   QGroupBox*                TypeBox;
155   QButtonGroup*             GroupType;
156     
157   QString                   myHelpFileName;
158
159   QString                   myEntry;
160   GrpList                   myGroups;
161
162 protected slots:
163   virtual void              reject();
164
165  private slots:
166   void                      ClickOnOk();
167   bool                      ClickOnApply();
168   void                      ClickOnHelp();
169   void                      updateControls();
170   void                      onDetect();
171   void                      onAddKeepNode();
172   void                      onRemoveKeepNode();
173   void                      onSelectKeepNode();
174   void                      onKeepNodeSourceChanged(int);
175   void                      onAddGroup();
176   void                      onRemoveGroup();
177   void                      onSelectGroup();
178   void                      onSelectAll( bool );
179   void                      onSelectElementFromGroup();
180   void                      onAddElement();
181   void                      onRemoveElement();
182   void                      onSetFirst();
183   void                      SetEditCurrentArgument();
184   void                      SelectionIntoArgument();
185   void                      DeactivateActiveDialog();
186   void                      ActivateThisDialog();
187   void                      onTypeChanged(int);
188   void                      onOpenView();
189   void                      onCloseView();
190 };
191
192 #endif // SMESHGUI_MergeDlg_H