Salome HOME
Copyright update: 2016
[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
39 // STL includes
40 #include <list>
41 #include <vector>
42
43 // IDL includes
44 #include <SALOMEconfig.h>
45 #include CORBA_SERVER_HEADER(SMESH_Mesh)
46
47 class LightApp_SelectionMgr;
48 class QButtonGroup;
49 class QCheckBox;
50 class QGroupBox;
51 class QLabel;
52 class QLineEdit;
53 class QListWidget;
54 class QPushButton;
55 class QRadioButton;
56 class SMESHGUI;
57 class SMESHGUI_IdPreview;
58 class SMESHGUI_SpinBox;
59 class SMESH_Actor;
60 class SUIT_SelectionFilter;
61 class SVTK_Selector;
62 class TColStd_MapOfInteger;
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                      isKeepNodesIDsSelection();
89   bool                      isNewKeepNodesGroup( 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::SMESH_IDSource_var mySubMeshOrGroup;
107   SMESH_Actor*              myActor;
108   SUIT_SelectionFilter*     myMeshOrSubMeshOrGroupFilter;
109   SUIT_SelectionFilter*     mySubMeshOrGroupFilter;
110
111   SMESHGUI_IdPreview*       myIdPreview;
112
113   int                       myAction;
114   bool                      myIsBusy;
115   int                       myTypeId; // manual(1) or automatic(0)
116
117   // Widgets
118
119   QGroupBox*                GroupButtons;
120   QPushButton*              buttonOk;
121   QPushButton*              buttonCancel;
122   QPushButton*              buttonApply;
123   QPushButton*              buttonHelp;
124
125   QGroupBox*                GroupMesh;
126   QLabel*                   TextLabelName;
127   QPushButton*              SelectMeshButton;
128   QLineEdit*                LineEditMesh;
129
130   QWidget*                  NodeSpecWidget;
131   SMESHGUI_SpinBox*         SpinBoxTolerance;
132   QCheckBox*                SeparateCornersAndMedium;
133
134   QGroupBox*                GroupCoincident;
135   //QWidget*                  GroupCoincidentWidget;
136   QPushButton*              DetectButton;
137   QListWidget*              ListCoincident;
138   QPushButton*              AddGroupButton;
139   QPushButton*              RemoveGroupButton;
140   QCheckBox*                SelectAllCB;
141   QCheckBox*                ShowIDs;
142
143   QGroupBox*                GroupEdit;
144   QListWidget*              ListEdit;
145   QPushButton*              AddElemButton;
146   QPushButton*              RemoveElemButton;
147   QPushButton*              SetFirstButton;
148
149   QGroupBox*                GroupExclude;
150   QListWidget*              ListExclude;
151
152   QGroupBox*                GroupKeep;
153   QButtonGroup*             KeepFromButGroup;
154   QPushButton*              SelectKeepNodesButton;
155   QPushButton*              AddKeepNodesButton;
156   QPushButton*              RemoveKeepNodesButton;
157   QListWidget*              KeepList;
158
159   QGroupBox*                TypeBox;
160   QButtonGroup*             GroupType;
161     
162   QString                   myHelpFileName;
163
164   QString                   myEntry;
165   GrpList                   myGroups;
166
167 protected slots:
168   virtual void              reject();
169
170  private slots:
171   void                      ClickOnOk();
172   bool                      ClickOnApply();
173   void                      ClickOnHelp();
174   void                      updateControls();
175   void                      onDetect();
176   void                      onAddKeepNode();
177   void                      onRemoveKeepNode();
178   void                      onSelectKeepNode();
179   void                      onKeepNodeSourceChanged(int);
180   void                      onAddGroup();
181   void                      onRemoveGroup();
182   void                      onSelectGroup();
183   void                      onSelectAll( bool );
184   void                      onSelectElementFromGroup();
185   void                      onAddElement();
186   void                      onRemoveElement();
187   void                      onSetFirst();
188   void                      SetEditCurrentArgument();
189   void                      SelectionIntoArgument();
190   void                      DeactivateActiveDialog();
191   void                      ActivateThisDialog();
192   void                      onTypeChanged(int);
193   void                      onOpenView();
194   void                      onCloseView();
195 };
196
197 #endif // SMESHGUI_MergeDlg_H