Salome HOME
b003b3842f42006ad215816093742e201d3497f7
[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
85   void                      FindGravityCenter( TColStd_MapOfInteger&, 
86                                                std::list<gp_XYZ>& );
87   // add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list
88
89 private:
90   typedef QList<SMESH::SMESH_GroupBase_var> GrpList;
91
92   SMESHGUI*                 mySMESHGUI;     /* Current SMESHGUI object */
93   LightApp_SelectionMgr*    mySelectionMgr; /* User shape selection */
94   SVTK_Selector*            mySelector;
95   
96   QWidget*                  myEditCurrentArgument;
97
98   SMESH::SMESH_Mesh_var     myMesh;
99   SMESH::SMESH_IDSource_var mySubMeshOrGroup;
100   SMESH_Actor*              myActor;
101   SUIT_SelectionFilter*     myMeshOrSubMeshOrGroupFilter;
102
103   SMESH::TIdPreview*        myIdPreview;
104
105   int                       myAction;
106   bool                      myIsBusy;
107   int                       myTypeId;
108
109   // Widgets
110   QGroupBox*                GroupConstructors;
111   QRadioButton*             RadioButton;
112
113   QGroupBox*                GroupButtons;
114   QPushButton*              buttonOk;
115   QPushButton*              buttonCancel;
116   QPushButton*              buttonApply;
117   QPushButton*              buttonHelp;
118
119   QGroupBox*                GroupMesh;
120   QLabel*                   TextLabelName;
121   QPushButton*              SelectMeshButton;
122   QLineEdit*                LineEditMesh;
123
124   QGroupBox*                GroupCoincident;
125   QWidget*                  GroupCoincidentWidget;
126   QLabel*                   TextLabelTolerance;
127   SMESHGUI_SpinBox*         SpinBoxTolerance;
128   QPushButton*              DetectButton;
129   QListWidget*              ListCoincident;
130   QPushButton*              AddGroupButton;
131   QPushButton*              RemoveGroupButton;
132   QCheckBox*                SelectAllCB;
133   QCheckBox*                ShowIDs;
134
135   QGroupBox*                GroupEdit;
136   QListWidget*              ListEdit;
137   QPushButton*              AddElemButton;
138   QPushButton*              RemoveElemButton;
139   QPushButton*              SetFirstButton;
140
141   QGroupBox*                GroupExclude;
142   QListWidget*              ListExclude;
143
144   QGroupBox*                TypeBox;
145   QButtonGroup*             GroupType;
146     
147   QString                   myHelpFileName;
148
149   QString                   myEntry;
150   GrpList                   myGroups;
151
152 protected slots:
153   virtual void              reject();
154
155  private slots:
156   void                      ClickOnOk();
157   bool                      ClickOnApply();
158   void                      ClickOnHelp();
159   void                      updateControls();
160   void                      onDetect();
161   void                      onAddGroup();
162   void                      onRemoveGroup();
163   void                      onSelectGroup();
164   void                      onSelectAll( bool );
165   void                      onSelectElementFromGroup();
166   void                      onAddElement();
167   void                      onRemoveElement();
168   void                      onSetFirst();
169   void                      SetEditCurrentArgument();
170   void                      SelectionIntoArgument();
171   void                      DeactivateActiveDialog();
172   void                      ActivateThisDialog();
173   void                      onTypeChanged(int);
174   void                      onOpenView();
175   void                      onCloseView();
176 };
177
178 #endif // SMESHGUI_MergeDlg_H