Salome HOME
Porting to CAS-6.2.1sp1
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_EditMeshDlg.h
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20
21 using namespace std;
22
23 #ifndef SMESHGUI_EditMeshDlg_H
24 #define SMESHGUI_EditMeshDlg_H
25
26 #include "SMESH_SMESHGUI.hxx"
27
28 #include "LightApp_SelectionMgr.h"
29 #include "SUIT_SelectionFilter.h"
30
31 // QT Includes
32 #include <qdialog.h>
33
34 // Open CASCADE Includes
35 #include <gp_XYZ.hxx>
36
37 class QGridLayout;
38 class QButtonGroup;
39 class QGroupBox;
40 class QLabel;
41 class QLineEdit;
42 class QPushButton;
43 class QRadioButton;
44 class QCheckBox;
45 class QListBox;
46 class SMESHGUI;
47 class SMESHGUI_SpinBox;
48 class SMESH_Actor;
49 class SALOME_Actor;
50 class SVTK_ViewWindow;
51 class SVTK_Selector;
52
53 namespace SMESH{
54   struct TIdPreview;
55 }
56
57 // IDL Headers
58 #include <SALOMEconfig.h>
59 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
60
61 //=================================================================================
62 // class    : SMESHGUI_EditMeshDlg
63 // purpose  : 
64 //=================================================================================
65 class SMESHGUI_EXPORT SMESHGUI_EditMeshDlg : public QDialog
66 {
67   Q_OBJECT;
68
69  public:
70   SMESHGUI_EditMeshDlg (SMESHGUI  * theModule,
71                         int         theAction);
72   ~SMESHGUI_EditMeshDlg();
73
74  private:
75   void Init();
76   void closeEvent (QCloseEvent*);
77   void enterEvent (QEvent*);              /* mouse enter the QWidget */
78   void hideEvent  (QHideEvent*);          /* ESC key */
79   void keyPressEvent(QKeyEvent*);
80   void onEditGroup();
81
82   void FindGravityCenter(TColStd_MapOfInteger & ElemsIdMap, 
83                          list< gp_XYZ > & GrCentersXYZ);
84   // add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list
85
86  private:
87   SMESHGUI*               mySMESHGUI;     /* Current SMESHGUI object */
88   LightApp_SelectionMgr*  mySelectionMgr; /* User shape selection */
89   SVTK_Selector*          mySelector;
90   
91   QWidget*                myEditCurrentArgument;
92
93   SMESH::SMESH_Mesh_var     myMesh;
94   SMESH::SMESH_IDSource_var mySubMeshOrGroup;
95   SMESH_Actor*              myActor;
96   SUIT_SelectionFilter*     myMeshOrSubMeshOrGroupFilter;
97
98   SMESH::TIdPreview*        myIdPreview;
99
100   int myAction;
101   bool myIsBusy;
102
103   // Widgets
104   QButtonGroup*     GroupConstructors;
105   QRadioButton*     RadioButton;
106
107   QGroupBox*        GroupButtons;
108   QPushButton*      buttonOk;
109   QPushButton*      buttonCancel;
110   QPushButton*      buttonApply;
111   QPushButton*      buttonHelp;
112
113   QGroupBox*        GroupMesh;
114   QLabel*           TextLabelName;
115   QPushButton*      SelectMeshButton;
116   QLineEdit*        LineEditMesh;
117
118   QGroupBox*        GroupCoincident;
119   QLabel*           TextLabelTolerance;
120   SMESHGUI_SpinBox* SpinBoxTolerance;
121   QPushButton*      DetectButton;
122   QListBox*         ListCoincident;
123   QPushButton*      AddGroupButton;
124   QPushButton*      RemoveGroupButton;
125   QCheckBox*        SelectAllCB;
126
127   QGroupBox*        GroupEdit;
128   QListBox*         ListEdit;
129   QPushButton*      AddElemButton;
130   QPushButton*      RemoveElemButton;
131   QPushButton*      SetFirstButton;
132     
133   //protected:
134   QGridLayout* DlgLayout;
135   QGridLayout* GroupConstructorsLayout;
136   QGridLayout* GroupButtonsLayout;
137   QGridLayout* GroupMeshLayout;
138   QGridLayout* GroupCoincidentLayout;
139   QGridLayout* GroupEditLayout;
140
141   QString myHelpFileName;
142
143  private slots:
144   void ClickOnOk();
145   void ClickOnCancel();
146   bool ClickOnApply();
147   void ClickOnHelp();
148   void updateControls();
149   void onDetect();
150   void onAddGroup();
151   void onRemoveGroup();
152   void onSelectGroup();
153   void onSelectAll(bool isToggled);
154   void onSelectElementFromGroup();
155   void onAddElement();
156   void onRemoveElement();
157   void onSetFirst();
158   void SetEditCurrentArgument();
159   void SelectionIntoArgument() ;
160   void DeactivateActiveDialog() ;
161   void ActivateThisDialog() ;
162
163 };
164
165 #endif // SMESHGUI_EditMeshDlg_H