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