Salome HOME
changement homardGen ==> adaptGen
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AdaptDlg.h
1 // Copyright (C) 2011-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // SMESH SMESHGUI : GUI for the adaptation in the SMESH component
21 // File   : SMESHGUI_AdaptDlg.h
22 // Author : GĂ©rald NICOLAS, EDF
23 //
24 #ifndef SMESHGUI_ADAPTDLG_H
25 #define SMESHGUI_ADAPTDLG_H
26
27 // SMESH includes
28 #include "SMESH_SMESHGUI.hxx"
29
30 // Qt includes
31 #include <QDialog>
32 #include <QList>
33 #include <QMap>
34
35 // IDL includes
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(SMESH_Mesh)
38 #include CORBA_SERVER_HEADER(SMESH_Group)
39 #include CORBA_SERVER_HEADER(SMESH_Filter)
40
41 class QGroupBox;
42 class QLabel;
43 class QLineEdit;
44 class QButtonGroup;
45 class QListWidget;
46 class QMenu;
47 class QPushButton;
48 class QToolButton;
49 class QCheckBox;
50 class QStackedWidget;
51 class QAction;
52 class SMESHGUI;
53 class SMESH_Actor;
54 class SMESHGUI_FilterDlg;
55 class SMESHGUI_ShapeByMeshOp;
56 class QtxColorButton;
57 class SUIT_Operation;
58 class SVTK_Selector;
59 class SUIT_SelectionFilter;
60 class LightApp_SelectionMgr;
61 class SMESH_LogicalFilter;
62
63 //=================================================================================
64 // class    : SMESHGUI_AdaptDlg
65 // purpose  :
66 //=================================================================================
67 class SMESHGUI_EXPORT SMESHGUI_AdaptDlg : public QDialog
68 {
69   Q_OBJECT
70
71 public:
72   SMESHGUI_AdaptDlg( SMESHGUI*,
73                      int theCommandID,
74                      SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
75   ~SMESHGUI_AdaptDlg();
76
77   virtual bool OnGUIEvent (int theCommandID);
78
79   static QString                GetDefaultName( const QString& );
80
81 public slots:
82   void onAdd();
83   void onRemove();
84
85 protected slots:
86   virtual void                  reject();
87
88 private slots:
89   void                          onTypeChanged( int );
90   void                          onGrpTypeChanged( int );
91   void                          onColorChanged( QColor );
92
93   void                          onOK();
94   bool                          onApply();
95   void                          onHelp();
96   void                          onDeactivate();
97   void                          onVisibilityChanged();
98
99   void                          onListSelectionChanged();
100   void                          onObjectSelectionChanged();
101
102   void                          onSelectAll();
103   void                          onSelectSubMesh( bool );
104   void                          onSelectGroup( bool );
105   void                          onSelectGeomGroup( bool );
106   void                          setCurrentSelection();
107
108   void                          setFilters();
109   void                          onSort();
110
111   void                          onNameChanged( const QString& );
112   void                          onFilterAccepted();
113
114   void                          onGeomPopup( QAction* );
115   void                          onGeomSelectionButton( bool );
116
117   void                          onPublishShapeByMeshDlg( SUIT_Operation* );
118   void                          onCloseShapeByMeshDlg( SUIT_Operation* );
119
120   void                          onOpenView();
121   void                          onCloseView();
122
123 private:
124   void                          initDialog( bool );
125   void                          init( SMESH::SMESH_Mesh_ptr );
126   void                          init( SMESH::SMESH_GroupBase_ptr );
127   void                          enterEvent( QEvent* );
128   void                          keyPressEvent( QKeyEvent* );
129   void                          setSelectionMode( int );
130   void                          updateButtons();
131   void                          updateGeomPopup();
132   bool                          SetAppropriateActor();
133   void                          setShowEntityMode();
134   void                          restoreShowEntityMode();
135
136   bool                          IsActorVisible( SMESH_Actor* );
137
138   void                          setGroupColor( const SALOMEDS::Color& );
139   SALOMEDS::Color               getGroupColor() const;
140
141   void                          setGroupQColor( const QColor& );
142   QColor                        getGroupQColor() const;
143   void                          setDefaultName() const;
144   void                          setDefaultGroupColor();
145
146   void                          setIsApplyAndClose( const bool theFlag );
147   bool                          isApplyAndClose() const;
148
149  private:
150
151   SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
152   LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
153   int                           myGrpTypeId;             /* Current group type id : standalone or group on geometry */
154   int                           myTypeId;                /* Current type id = radio button id */
155   int                           myStoredShownEntity;     /* Store ShowEntity mode of myMesh */
156   QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
157   SVTK_Selector*                mySelector;
158
159   QPushButton*                  myMeshGroupBtn;
160   QLineEdit*                    myMeshGroupLine;
161
162   QButtonGroup*                 myTypeGroup;
163   QLineEdit*                    myName;
164   QString                       myOldName;
165
166   QButtonGroup*                 myGrpTypeGroup;
167
168   QStackedWidget*               myWGStack;
169   QCheckBox*                    mySelectAll;
170   QCheckBox*                    myAllowElemsModif;
171   QLabel*                       myElementsLab;
172   QListWidget*                  myElements;
173   QPushButton*                  myFilterBtn;
174   QPushButton*                  myAddBtn;
175   QPushButton*                  myRemoveBtn;
176   QPushButton*                  mySortBtn;
177
178   QGroupBox*                    mySelectBox;
179   QCheckBox*                    mySelectSubMesh;
180   QPushButton*                  mySubMeshBtn;
181   QLineEdit*                    mySubMeshLine;
182   QCheckBox*                    mySelectGroup;
183   QPushButton*                  myGroupBtn;
184   QLineEdit*                    myGroupLine;
185
186   QtxColorButton*               myColorBtn;
187
188   QCheckBox*                    mySelectGeomGroup;
189   QToolButton*                  myGeomGroupBtn;
190   QLineEdit*                    myGeomGroupLine;
191   QMenu*                        myGeomPopup;
192
193   QPushButton*                  myOKBtn;
194   QPushButton*                  myApplyBtn;
195   QPushButton*                  myCloseBtn;
196   QPushButton*                  myHelpBtn;
197
198   SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
199
200   SMESH::SMESH_Mesh_var         myMesh;
201   QList<SMESH_Actor*>           myActorsList;
202   SMESH::SMESH_Group_var        myGroup;
203   SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
204   SMESH::SMESH_GroupOnFilter_var myGroupOnFilter;
205   SMESH::Filter_var             myFilter;
206   QList<int>                    myIdList;
207   GEOM::ListOfGO_var            myGeomObjects;
208
209   int                           mySelectionMode;
210   //Handle(SMESH_TypeFilter)      myMeshFilter;
211   //Handle(SMESH_TypeFilter)      mySubMeshFilter;
212   //Handle(SMESH_TypeFilter)      myGroupFilter;
213   SUIT_SelectionFilter*         myMeshFilter;
214   SMESH_LogicalFilter*          mySubMeshFilter;
215   SMESH_LogicalFilter*          myGroupFilter;
216   SUIT_SelectionFilter*         myGeomFilter;
217
218   SMESHGUI_FilterDlg*           myFilterDlg;
219
220   bool                          myCreate, myIsBusy;
221
222   QString                       myHelpFileName;
223
224   QMap<QAction*, int>           myActions;
225
226   bool                          myNameChanged; //added by skl for IPAL19574
227   int                           myNbChangesOfContents; // nb add's and remove's
228
229   QString                       myObjectToSelect;
230   bool                          myIsApplyAndClose;
231 };
232
233 #endif // SMESHGUI_ADAPTDLG_H