]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_GroupDlg.h
Salome HOME
Fix OwnHypothesis()
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupDlg.h
1 // Copyright (C) 2007-2013  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
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File   : SMESHGUI_GroupDlg.h
25 // Author : Natalia KOPNOVA, Open CASCADE S.A.S.
26 //
27 #ifndef SMESHGUI_GROUPDLG_H
28 #define SMESHGUI_GROUPDLG_H
29
30 // SMESH includes
31 #include "SMESH_SMESHGUI.hxx"
32
33 // Qt includes
34 #include <QDialog>
35 #include <QList>
36 #include <QMap>
37
38 // IDL includes
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SMESH_Mesh)
41 #include CORBA_SERVER_HEADER(SMESH_Group)
42 #include CORBA_SERVER_HEADER(SMESH_Filter)
43
44 class QGroupBox;
45 class QLabel;
46 class QLineEdit;
47 class QButtonGroup;
48 class QListWidget;
49 class QMenu;
50 class QPushButton;
51 class QToolButton;
52 class QCheckBox;
53 class QStackedWidget;
54 class QAction;
55 class SMESHGUI;
56 class SMESH_Actor;
57 class SMESHGUI_FilterDlg;
58 class SMESHGUI_ShapeByMeshOp;
59 class QtxColorButton;
60 class SUIT_Operation;
61 class SVTK_Selector;
62 class SUIT_SelectionFilter;
63 class LightApp_SelectionMgr;
64 class SMESH_LogicalFilter;
65
66 //=================================================================================
67 // class    : SMESHGUI_GroupDlg
68 // purpose  :
69 //=================================================================================
70 class SMESHGUI_EXPORT SMESHGUI_GroupDlg : public QDialog
71
72   Q_OBJECT
73
74 public:
75   SMESHGUI_GroupDlg( SMESHGUI*,
76                      SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
77   SMESHGUI_GroupDlg( SMESHGUI*,
78                      SMESH::SMESH_GroupBase_ptr,
79                      const bool theIsConvert = false );
80   ~SMESHGUI_GroupDlg();
81   
82   static QString                GetDefaultName( const QString& );
83   
84 public slots:
85   void onAdd();
86   void onRemove();
87
88 protected slots:
89   virtual void                  reject();
90
91 private slots:
92   void                          onTypeChanged( int );
93   void                          onGrpTypeChanged( int );
94   void                          onColorChanged( QColor );
95   
96   void                          onOK();
97   bool                          onApply();
98   void                          onHelp();
99   void                          onDeactivate();
100   void                          onVisibilityChanged();
101   
102   void                          onListSelectionChanged();
103   void                          onObjectSelectionChanged();
104   
105   void                          onSelectAll();
106   void                          onSelectSubMesh( bool );
107   void                          onSelectGroup( bool );
108   void                          onSelectGeomGroup( bool );
109   void                          setCurrentSelection();
110   
111   void                          setFilters();
112   void                          onSort();
113   
114   void                          onNameChanged( const QString& );
115   void                          onFilterAccepted();
116   
117   void                          onGeomPopup( QAction* );
118   void                          onGeomSelectionButton( bool );
119   
120   void                          onPublishShapeByMeshDlg( SUIT_Operation* );
121   void                          onCloseShapeByMeshDlg( SUIT_Operation* );
122
123 private:
124   void                          initDialog( bool );
125   void                          init( SMESH::SMESH_Mesh_ptr );
126   void                          init( SMESH::SMESH_GroupBase_ptr,
127                                       const bool theIsConvert = false );
128   void                          enterEvent( QEvent* );
129   void                          keyPressEvent( QKeyEvent* );
130   void                          setSelectionMode( int );
131   void                          updateButtons();
132   void                          updateGeomPopup();
133   bool                          SetAppropriateActor();
134   void                          setShowEntityMode();
135   void                          restoreShowEntityMode();
136
137   bool                          IsActorVisible( SMESH_Actor* );
138   
139   void                          setGroupColor( const SALOMEDS::Color& );
140   SALOMEDS::Color               getGroupColor() const;
141   
142   void                          setGroupQColor( const QColor& );
143   QColor                        getGroupQColor() const;
144   void                          setDefaultName() const;
145   void                          setDefaultGroupColor();
146
147   void                          setIsApplyAndClose( const bool theFlag );
148   bool                          isApplyAndClose() const;
149
150  private:
151
152   SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
153   LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
154   int                           myGrpTypeId;             /* Current group type id : standalone or group on geometry */
155   int                           myTypeId;                /* Current type id = radio button id */
156   int                           myStoredShownEntity;     /* Store ShowEntity mode of myMesh */
157   QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
158   SVTK_Selector*                mySelector;
159   
160   QPushButton*                  myMeshGroupBtn;
161   QLineEdit*                    myMeshGroupLine;
162   
163   QButtonGroup*                 myTypeGroup;
164   QLineEdit*                    myName;
165   QString                       myOldName;
166   
167   QButtonGroup*                 myGrpTypeGroup;
168   
169   QStackedWidget*               myWGStack;
170   QCheckBox*                    mySelectAll;
171   QCheckBox*                    myAllowElemsModif;
172   QLabel*                       myElementsLab;
173   QListWidget*                  myElements;
174   QPushButton*                  myFilterBtn;
175   QPushButton*                  myAddBtn;
176   QPushButton*                  myRemoveBtn;
177   QPushButton*                  mySortBtn;
178   
179   QGroupBox*                    mySelectBox;
180   QCheckBox*                    mySelectSubMesh;
181   QPushButton*                  mySubMeshBtn;
182   QLineEdit*                    mySubMeshLine;
183   QCheckBox*                    mySelectGroup;
184   QPushButton*                  myGroupBtn;
185   QLineEdit*                    myGroupLine;
186   
187   QtxColorButton*               myColorBtn;
188   
189   QCheckBox*                    mySelectGeomGroup;
190   QToolButton*                  myGeomGroupBtn;
191   QLineEdit*                    myGeomGroupLine;
192   QMenu*                        myGeomPopup;
193
194   QPushButton*                  myOKBtn;
195   QPushButton*                  myApplyBtn;
196   QPushButton*                  myCloseBtn;
197   QPushButton*                  myHelpBtn;
198   
199   SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
200   
201   SMESH::SMESH_Mesh_var         myMesh;
202   QList<SMESH_Actor*>           myActorsList;
203   SMESH::SMESH_Group_var        myGroup;
204   SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
205   SMESH::SMESH_GroupOnFilter_var myGroupOnFilter;
206   SMESH::Filter_var             myFilter;
207   QList<int>                    myIdList;
208   GEOM::ListOfGO_var            myGeomObjects;
209   
210   int                           mySelectionMode;
211   //Handle(SMESH_TypeFilter)      myMeshFilter;
212   //Handle(SMESH_TypeFilter)      mySubMeshFilter;
213   //Handle(SMESH_TypeFilter)      myGroupFilter;
214   SUIT_SelectionFilter*         myMeshFilter;
215   SMESH_LogicalFilter*          mySubMeshFilter;
216   SMESH_LogicalFilter*          myGroupFilter;
217   SUIT_SelectionFilter*         myGeomFilter;
218   
219   SMESHGUI_FilterDlg*           myFilterDlg;
220   
221   bool                          myCreate, myIsBusy;
222   
223   QString                       myHelpFileName;
224   
225   QMap<QAction*, int>           myActions;
226
227   bool                          myNameChanged; //added by skl for IPAL19574
228   int                           myNbChangesOfContents; // nb add's and remove's
229
230   QString                       myObjectToSelect;
231   bool                          myIsApplyAndClose;
232 };
233
234 #endif // SMESHGUI_GROUPDLG_H