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