Version: 8.3.0
SMESHGUI_MeshPatternDlg.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 // File : SMESHGUI_MeshPatternDlg.h
24 // Author : Sergey LITONIN, Open CASCADE S.A.S.
25 //
26 #ifndef SMESHGUI_MESHPATTERNDLG_H
27 #define SMESHGUI_MESHPATTERNDLG_H
28 
29 // SMESH includes
30 #include "SMESH_SMESHGUI.hxx"
31 
32 // Qt includes
33 #include <QDialog>
34 #include <QMap>
35 
36 // IDL includes
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Mesh)
39 #include CORBA_SERVER_HEADER(SMESH_Pattern)
40 
41 class QFrame;
42 class QLineEdit;
43 class QPushButton;
44 class QRadioButton;
45 class QCheckBox;
46 class QButtonGroup;
47 class QLabel;
48 class SalomeApp_IntSpinBox;
50 class SALOME_Actor;
51 class SVTK_Selector;
52 class LightApp_SelectionMgr;
53 class SMESHGUI;
56 
57 /*
58  Class : SMESHGUI_MeshPatternDlg
59  Description : Dialog to specify filters for VTK viewer
60 */
61 
63 {
64  Q_OBJECT
65 
66  // Pattern type
67  enum { Type_2d, Type_3d };
68 
69  // selection input
70  enum { Mesh, Object, Vertex1, Vertex2, Ids };
71 
72 public:
74  virtual ~SMESHGUI_MeshPatternDlg();
75 
76  void Init();
77 
78 protected slots:
79  virtual void reject();
80 
81 private slots:
82  void onOk();
83  bool onApply();
84  void onHelp();
85 
86  void onDeactivate();
87 
88  void onSelectionDone();
89  void onSelInputChanged();
90 
91  void onTypeChanged( int );
92  void onModeToggled( bool );
93  void onOpen();
94  void onNew();
95  void onReverse( bool );
96  void onPreview( bool );
97  void onOkCreationDlg();
98  void onCloseCreationDlg();
99  void onTextChanged( const QString& );
100  void onNodeChanged( int );
101  void onOpenView();
102  void onCloseView();
103 
104 private:
105  QWidget* createButtonFrame( QWidget* );
106  QWidget* createMainFrame( QWidget* );
107  void displayPreview();
108  vtkUnstructuredGrid* getGrid();
109  void erasePreview();
110  void updateWgState();
111  bool loadFromFile( const QString& );
112  void activateSelection();
113  QStringList prepareFilters() const;
114  QString autoExtension( const QString& ) const;
115  void enterEvent( QEvent* );
116  void keyPressEvent( QKeyEvent* );
117  bool isValid( const bool = true );
118  void resetSelInput();
119  bool isRefine() const;
120 
121  bool getIds( QList<int>& ) const;
122  int getNode( bool = false ) const;
123 
124 private:
125  QPushButton* myOkBtn;
126  QPushButton* myApplyBtn;
127  QPushButton* myCloseBtn;
128  QPushButton* myHelpBtn;
129 
130  QButtonGroup* myTypeGrp;
131  QRadioButton* mySwitch2d;
132  QRadioButton* mySwitch3d;
133 
134  QCheckBox* myRefine;
135 
137  SalomeApp_IntSpinBox* myNode1;
138  SalomeApp_IntSpinBox* myNode2;
139  QLabel* myNode2Lbl;
140 
142  QMap<int, QPushButton*> mySelBtn;
143  QMap<int, QLineEdit*> mySelEdit;
144  QMap<int, QLabel*> mySelLbl;
145 
147 
148  QLineEdit* myName;
149  QPushButton* myOpenBtn;
150  QPushButton* myNewBtn;
151 
152  QCheckBox* myReverseChk;
156  QLabel* myPicture3d;
157 
158  QCheckBox* myPreviewChk;
159 
161  SVTK_Selector* mySelector;
162  LightApp_SelectionMgr* mySelectionMgr;
165  int myType;
167  bool myBusy;
168 
169  SMESH::SMESH_Mesh_var myMesh;
170  GEOM::GEOM_Object_var myMeshShape;
171  QMap<int, GEOM::GEOM_Object_var> myGeomObj;
172 
174  SMESH::SMESH_Pattern_var myPattern;
176 
177  QString myHelpFileName;
178 };
179 
180 #endif // SMESHGUI_MESHPATTERNDLG_H