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