Salome HOME
Merge with OCC_development_01
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshPatternDlg.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 //
20 //
21 //
22 //  File   : SMESHGUI_MeshPatternDlg.h
23 //  Author : Sergey LITONIN
24 //  Module : SMESH
25
26
27 #ifndef SMESHGUI_MeshPatternDlg_H
28 #define SMESHGUI_MeshPatternDlg_H
29
30 #include <qdialog.h>
31
32 // IDL Headers
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(GEOM_Gen)
35 #include CORBA_SERVER_HEADER(SMESH_Mesh)
36 #include CORBA_SERVER_HEADER(SMESH_Pattern)
37
38 class QCloseEvent;
39 class QFrame;
40 class QLineEdit;
41 class SMESHGUI_SpinBox;
42 class QPushButton;
43 class SALOME_Selection;
44 class QRadioButton;
45 class QCheckBox;
46 class QButtonGroup;
47 class QLabel;
48 class QSpinBox;
49 class QGroupBox;
50 class SMESHGUI_CreatePatternDlg;
51 class SMESHGUI_PatternWidget;
52 class vtkUnstructuredGrid;
53 class SALOME_Actor;
54
55 /*
56   Class       : SMESHGUI_MeshPatternDlg
57   Description : Dialog to specify filters for VTK viewer
58 */
59
60 class SMESHGUI_MeshPatternDlg : public QDialog
61 {
62   Q_OBJECT
63
64   // Pattern type
65   enum { Type_2d, Type_3d };
66
67   // selection input
68   enum { Mesh, Object, Vertex1, Vertex2, Ids };
69
70 public:
71                                       SMESHGUI_MeshPatternDlg( QWidget*,
72                                                                SALOME_Selection*,
73                                                                const char* = 0 );
74   virtual                             ~SMESHGUI_MeshPatternDlg();
75
76   void                                Init( SALOME_Selection* );
77   
78 private slots:
79
80   void                                onOk();
81   bool                                onApply();
82   void                                onClose();
83
84   void                                onDeactivate();
85
86   void                                onSelectionDone();
87   void                                onSelInputChanged();
88
89   void                                onTypeChanged( int );
90   void                                onModeToggled( bool );
91   void                                onOpen();
92   void                                onNew();
93   void                                onReverse( bool );
94   void                                onPreview( bool );
95   void                                onOkCreationDlg();
96   void                                onCloseCreationDlg();
97   void                                onTextChanged( const QString& );
98   void                                onNodeChanged( int value );
99
100 private:
101
102   QFrame*                             createButtonFrame( QWidget* );
103   QFrame*                             createMainFrame  ( QWidget* );
104   void                                displayPreview();
105   vtkUnstructuredGrid*                getGrid();
106   void                                erasePreview();
107   void                                updateWgState();
108   bool                                loadFromFile( const QString& );
109   void                                activateSelection();
110   QStringList                         prepareFilters() const;
111   QString                             autoExtension( const QString& theFileName ) const;
112   void                                closeEvent( QCloseEvent* e ) ;
113   void                                enterEvent ( QEvent * ) ;
114   bool                                isValid( const bool theMess = true );
115   void                                resetSelInput();
116   bool                                isRefine() const;
117
118   bool                                getIds( QValueList<int>& ) const;
119   int                                 getNode( bool = false ) const;
120
121 private:
122
123   QPushButton*                        myOkBtn;
124   QPushButton*                        myApplyBtn;
125   QPushButton*                        myCloseBtn;
126
127   QButtonGroup*                       myTypeGrp;
128   QRadioButton*                       mySwitch2d;
129   QRadioButton*                       mySwitch3d;
130
131   QCheckBox*                          myRefine;
132
133   QFrame*                             myRefineGrp;
134   QSpinBox*                           myNode1;
135   QSpinBox*                           myNode2;
136   QLabel*                             myNode2Lbl;
137
138   QGroupBox*                          myGeomGrp;
139   QMap< int, QPushButton* >           mySelBtn;
140   QMap< int, QLineEdit* >             mySelEdit;
141   QMap< int, QLabel* >                mySelLbl;
142
143   QLineEdit*                          myName;
144   QPushButton*                        myOpenBtn;
145   QPushButton*                        myNewBtn;
146
147   QCheckBox*                          myReverseChk;
148   SMESHGUI_PatternWidget*             myPicture2d;
149   QFrame*                             myPicture3d;
150   QLabel*                             myPreview3d;
151
152   QCheckBox*                          myPreviewChk;
153     
154   SALOME_Selection*                   mySelection;
155   int                                 mySelInput;
156   int                                 myNbPoints;
157   int                                 myType;
158   bool                                myIsCreateDlgOpen;
159   bool                                myBusy;
160
161   SMESH::SMESH_Mesh_var               myMesh;
162   GEOM::GEOM_Object_var               myMeshShape;
163   QMap< int, GEOM::GEOM_Object_var >  myGeomObj;
164   
165   SMESHGUI_CreatePatternDlg*          myCreationDlg;
166   SMESH::SMESH_Pattern_var            myPattern;
167   SALOME_Actor*                       myPreviewActor;
168 };
169
170 #endif
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187