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