Salome HOME
Merge from BR_phase16 branch (09/12/09)
[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 SMESHGUI;
53 class SMESHGUI_SpinBox;
54 class SMESH_Actor;
55 class SVTK_Selector;
56 class LightApp_SelectionMgr;
57 class SUIT_SelectionFilter;
58 class TColStd_MapOfInteger;
59
60 namespace SMESH
61 {
62   struct TIdPreview;
63 }
64
65 //=================================================================================
66 // class    : SMESHGUI_EditMeshDlg
67 // purpose  : 
68 //=================================================================================
69 class SMESHGUI_EXPORT SMESHGUI_EditMeshDlg : public QDialog
70 {
71   Q_OBJECT;
72
73 public:
74   SMESHGUI_EditMeshDlg( SMESHGUI*, int );
75   ~SMESHGUI_EditMeshDlg();
76
77 private:
78   void                      Init();
79   void                      closeEvent( QCloseEvent* );
80   void                      enterEvent( QEvent* );              /* mouse enter the QWidget */
81   void                      hideEvent( QHideEvent* );           /* ESC key */
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   SMESHGUI*                 mySMESHGUI;     /* Current SMESHGUI object */
91   LightApp_SelectionMgr*    mySelectionMgr; /* User shape selection */
92   SVTK_Selector*            mySelector;
93   
94   QWidget*                  myEditCurrentArgument;
95
96   SMESH::SMESH_Mesh_var     myMesh;
97   SMESH::SMESH_IDSource_var mySubMeshOrGroup;
98   SMESH_Actor*              myActor;
99   SUIT_SelectionFilter*     myMeshOrSubMeshOrGroupFilter;
100
101   SMESH::TIdPreview*        myIdPreview;
102
103   int                       myAction;
104   bool                      myIsBusy;
105
106   // Widgets
107   QGroupBox*                GroupConstructors;
108   QRadioButton*             RadioButton;
109
110   QGroupBox*                GroupButtons;
111   QPushButton*              buttonOk;
112   QPushButton*              buttonCancel;
113   QPushButton*              buttonApply;
114   QPushButton*              buttonHelp;
115
116   QGroupBox*                GroupMesh;
117   QLabel*                   TextLabelName;
118   QPushButton*              SelectMeshButton;
119   QLineEdit*                LineEditMesh;
120
121   QGroupBox*                GroupCoincident;
122   QLabel*                   TextLabelTolerance;
123   SMESHGUI_SpinBox*         SpinBoxTolerance;
124   QPushButton*              DetectButton;
125   QListWidget*              ListCoincident;
126   QPushButton*              AddGroupButton;
127   QPushButton*              RemoveGroupButton;
128   QCheckBox*                SelectAllCB;
129
130   QGroupBox*                GroupEdit;
131   QListWidget*              ListEdit;
132   QPushButton*              AddElemButton;
133   QPushButton*              RemoveElemButton;
134   QPushButton*              SetFirstButton;
135     
136   QString                   myHelpFileName;
137
138  private slots:
139   void                      ClickOnOk();
140   void                      ClickOnCancel();
141   bool                      ClickOnApply();
142   void                      ClickOnHelp();
143   void                      updateControls();
144   void                      onDetect();
145   void                      onAddGroup();
146   void                      onRemoveGroup();
147   void                      onSelectGroup();
148   void                      onSelectAll( bool );
149   void                      onSelectElementFromGroup();
150   void                      onAddElement();
151   void                      onRemoveElement();
152   void                      onSetFirst();
153   void                      SetEditCurrentArgument();
154   void                      SelectionIntoArgument();
155   void                      DeactivateActiveDialog();
156   void                      ActivateThisDialog();
157 };
158
159 #endif // SMESHGUI_EDITMESHDLG_H