Salome HOME
2a9c487ae01fba4a5b96b1c7371bc223a8ae8cb4
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_EditMeshDlg.h
1 //  Copyright (C) 2007-2008  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.
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 // SMESH SMESHGUI : GUI for SMESH component
23 // File   : SMESHGUI_EditMeshDlg.h
24 // Author : Open CASCADE S.A.S.
25 //
26 #ifndef SMESHGUI_EDITMESHDLG_H
27 #define SMESHGUI_EDITMESHDLG_H
28
29 // SMESH includes
30 #include "SMESH_SMESHGUI.hxx"
31
32 // Qt includes
33 #include <QDialog>
34
35 // OCCT includes
36 #include <gp_XYZ.hxx>
37
38 // STL includes
39 #include <list>
40
41 // IDL includes
42 #include <SALOMEconfig.h>
43 #include CORBA_SERVER_HEADER(SMESH_Mesh)
44
45 class QGroupBox;
46 class QLabel;
47 class QLineEdit;
48 class QPushButton;
49 class QRadioButton;
50 class QCheckBox;
51 class QListWidget;
52 class QButtonGroup;
53 class SMESHGUI;
54 class SMESHGUI_SpinBox;
55 class SMESH_Actor;
56 class SVTK_Selector;
57 class LightApp_SelectionMgr;
58 class SUIT_SelectionFilter;
59 class TColStd_MapOfInteger;
60
61 namespace SMESH
62 {
63   struct TIdPreview;
64 }
65
66 //=================================================================================
67 // class    : SMESHGUI_EditMeshDlg
68 // purpose  : 
69 //=================================================================================
70 class SMESHGUI_EXPORT SMESHGUI_EditMeshDlg : public QDialog
71 {
72   Q_OBJECT;
73
74 public:
75   SMESHGUI_EditMeshDlg( SMESHGUI*, int );
76   ~SMESHGUI_EditMeshDlg();
77
78 private:
79   void                      Init();
80   void                      closeEvent( QCloseEvent* );
81   void                      enterEvent( QEvent* );              /* mouse enter the QWidget */
82   void                      hideEvent( QHideEvent* );           /* ESC key */
83   void                      keyPressEvent( QKeyEvent* );
84   void                      onEditGroup();
85
86   void                      FindGravityCenter( TColStd_MapOfInteger&, 
87                                                std::list<gp_XYZ>& );
88   // add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list
89
90 private:
91   SMESHGUI*                 mySMESHGUI;     /* Current SMESHGUI object */
92   LightApp_SelectionMgr*    mySelectionMgr; /* User shape selection */
93   SVTK_Selector*            mySelector;
94   
95   QWidget*                  myEditCurrentArgument;
96
97   SMESH::SMESH_Mesh_var     myMesh;
98   SMESH::SMESH_IDSource_var mySubMeshOrGroup;
99   SMESH_Actor*              myActor;
100   SUIT_SelectionFilter*     myMeshOrSubMeshOrGroupFilter;
101
102   SMESH::TIdPreview*        myIdPreview;
103
104   int                       myAction;
105   bool                      myIsBusy;
106   int                       myTypeId;
107
108   // Widgets
109   QGroupBox*                GroupConstructors;
110   QRadioButton*             RadioButton;
111
112   QGroupBox*                GroupButtons;
113   QPushButton*              buttonOk;
114   QPushButton*              buttonCancel;
115   QPushButton*              buttonApply;
116   QPushButton*              buttonHelp;
117
118   QGroupBox*                GroupMesh;
119   QLabel*                   TextLabelName;
120   QPushButton*              SelectMeshButton;
121   QLineEdit*                LineEditMesh;
122
123   QGroupBox*                GroupCoincident;
124   QWidget*                  GroupCoincidentWidget;
125   QLabel*                   TextLabelTolerance;
126   SMESHGUI_SpinBox*         SpinBoxTolerance;
127   QPushButton*              DetectButton;
128   QListWidget*              ListCoincident;
129   QPushButton*              AddGroupButton;
130   QPushButton*              RemoveGroupButton;
131   QCheckBox*                SelectAllCB;
132
133   QGroupBox*                GroupEdit;
134   QListWidget*              ListEdit;
135   QPushButton*              AddElemButton;
136   QPushButton*              RemoveElemButton;
137   QPushButton*              SetFirstButton;
138
139   QGroupBox*                TypeBox;
140   QButtonGroup*             GroupType;
141     
142   QString                   myHelpFileName;
143
144  private slots:
145   void                      ClickOnOk();
146   void                      ClickOnCancel();
147   bool                      ClickOnApply();
148   void                      ClickOnHelp();
149   void                      updateControls();
150   void                      onDetect();
151   void                      onAddGroup();
152   void                      onRemoveGroup();
153   void                      onSelectGroup();
154   void                      onSelectAll( bool );
155   void                      onSelectElementFromGroup();
156   void                      onAddElement();
157   void                      onRemoveElement();
158   void                      onSetFirst();
159   void                      SetEditCurrentArgument();
160   void                      SelectionIntoArgument();
161   void                      DeactivateActiveDialog();
162   void                      ActivateThisDialog();
163   void                      onTypeChanged(int);
164 };
165
166 #endif // SMESHGUI_EDITMESHDLG_H