Version: 8.3.0
SMESHGUI_GroupDlg.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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;
59 class QtxColorButton;
60 class SUIT_Operation;
61 class SVTK_Selector;
63 class LightApp_SelectionMgr;
65 
66 //=================================================================================
67 // class : SMESHGUI_GroupDlg
68 // purpose :
69 //=================================================================================
71 {
72  Q_OBJECT
73 
74 public:
76  SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
78  SMESH::SMESH_GroupBase_ptr,
79  const bool theIsConvert = false );
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  void onOpenView();
124  void onCloseView();
125 
126 private:
127  void initDialog( bool );
128  void init( SMESH::SMESH_Mesh_ptr );
129  void init( SMESH::SMESH_GroupBase_ptr,
130  const bool theIsConvert = false );
131  void enterEvent( QEvent* );
132  void keyPressEvent( QKeyEvent* );
133  void setSelectionMode( int );
134  void updateButtons();
135  void updateGeomPopup();
136  bool SetAppropriateActor();
137  void setShowEntityMode();
138  void restoreShowEntityMode();
139 
140  bool IsActorVisible( SMESH_Actor* );
141 
142  void setGroupColor( const SALOMEDS::Color& );
143  SALOMEDS::Color getGroupColor() const;
144 
145  void setGroupQColor( const QColor& );
146  QColor getGroupQColor() const;
147  void setDefaultName() const;
148  void setDefaultGroupColor();
149 
150  void setIsApplyAndClose( const bool theFlag );
151  bool isApplyAndClose() const;
152 
153  private:
154 
155  SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
156  LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
157  int myGrpTypeId; /* Current group type id : standalone or group on geometry */
158  int myTypeId; /* Current type id = radio button id */
159  int myStoredShownEntity; /* Store ShowEntity mode of myMesh */
160  QLineEdit* myCurrentLineEdit; /* Current LineEdit */
161  SVTK_Selector* mySelector;
162 
163  QPushButton* myMeshGroupBtn;
164  QLineEdit* myMeshGroupLine;
165 
166  QButtonGroup* myTypeGroup;
167  QLineEdit* myName;
168  QString myOldName;
169 
170  QButtonGroup* myGrpTypeGroup;
171 
172  QStackedWidget* myWGStack;
173  QCheckBox* mySelectAll;
174  QCheckBox* myAllowElemsModif;
175  QLabel* myElementsLab;
176  QListWidget* myElements;
177  QPushButton* myFilterBtn;
178  QPushButton* myAddBtn;
179  QPushButton* myRemoveBtn;
180  QPushButton* mySortBtn;
181 
183  QCheckBox* mySelectSubMesh;
184  QPushButton* mySubMeshBtn;
185  QLineEdit* mySubMeshLine;
186  QCheckBox* mySelectGroup;
187  QPushButton* myGroupBtn;
188  QLineEdit* myGroupLine;
189 
190  QtxColorButton* myColorBtn;
191 
192  QCheckBox* mySelectGeomGroup;
193  QToolButton* myGeomGroupBtn;
194  QLineEdit* myGeomGroupLine;
195  QMenu* myGeomPopup;
196 
197  QPushButton* myOKBtn;
198  QPushButton* myApplyBtn;
199  QPushButton* myCloseBtn;
200  QPushButton* myHelpBtn;
201 
203 
204  SMESH::SMESH_Mesh_var myMesh;
205  QList<SMESH_Actor*> myActorsList;
206  SMESH::SMESH_Group_var myGroup;
207  SMESH::SMESH_GroupOnGeom_var myGroupOnGeom;
208  SMESH::SMESH_GroupOnFilter_var myGroupOnFilter;
209  SMESH::Filter_var myFilter;
210  QList<int> myIdList;
211  GEOM::ListOfGO_var myGeomObjects;
212 
214  //Handle(SMESH_TypeFilter) myMeshFilter;
215  //Handle(SMESH_TypeFilter) mySubMeshFilter;
216  //Handle(SMESH_TypeFilter) myGroupFilter;
221 
223 
224  bool myCreate, myIsBusy;
225 
226  QString myHelpFileName;
227 
228  QMap<QAction*, int> myActions;
229 
230  bool myNameChanged; //added by skl for IPAL19574
231  int myNbChangesOfContents; // nb add's and remove's
232 
235 };
236 
237 #endif // SMESHGUI_GROUPDLG_H