Salome HOME
Update mail address
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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 LightApp_SelectionMgr;
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 class SVTK_ViewWindow;
55 class SVTK_Selector;
56 class SMESHGUI;
57
58 /*
59   Class       : SMESHGUI_MeshPatternDlg
60   Description : Dialog to specify filters for VTK viewer
61 */
62
63 class SMESHGUI_MeshPatternDlg : public QDialog
64 {
65   Q_OBJECT
66
67   // Pattern type
68   enum { Type_2d, Type_3d };
69
70   // selection input
71   enum { Mesh, Object, Vertex1, Vertex2, Ids };
72
73 public:
74                                       SMESHGUI_MeshPatternDlg( SMESHGUI*,
75                                                                const char* = 0 );
76   virtual                             ~SMESHGUI_MeshPatternDlg();
77
78   void                                Init();
79   
80 private slots:
81
82   void                                onOk();
83   bool                                onApply();
84   void                                onClose();
85   void                                onHelp();
86
87   void                                onDeactivate();
88
89   void                                onSelectionDone();
90   void                                onSelInputChanged();
91
92   void                                onTypeChanged( int );
93   void                                onModeToggled( bool );
94   void                                onOpen();
95   void                                onNew();
96   void                                onReverse( bool );
97   void                                onPreview( bool );
98   void                                onOkCreationDlg();
99   void                                onCloseCreationDlg();
100   void                                onTextChanged( const QString& );
101   void                                onNodeChanged( int value );
102
103 private:
104
105   QFrame*                             createButtonFrame( QWidget* );
106   QFrame*                             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& theFileName ) const;
115   void                                closeEvent( QCloseEvent* e ) ;
116   void                                enterEvent ( QEvent * ) ;
117   bool                                isValid( const bool theMess = true );
118   void                                resetSelInput();
119   bool                                isRefine() const;
120
121   bool                                getIds( QValueList<int>& ) const;
122   int                                 getNode( bool = false ) const;
123
124 private:
125
126   QPushButton*                        myOkBtn;
127   QPushButton*                        myApplyBtn;
128   QPushButton*                        myCloseBtn;
129   QPushButton*                        myHelpBtn;
130
131   QButtonGroup*                       myTypeGrp;
132   QRadioButton*                       mySwitch2d;
133   QRadioButton*                       mySwitch3d;
134
135   QCheckBox*                          myRefine;
136
137   QFrame*                             myRefineGrp;
138   QSpinBox*                           myNode1;
139   QSpinBox*                           myNode2;
140   QLabel*                             myNode2Lbl;
141
142   QGroupBox*                          myGeomGrp;
143   QMap< int, QPushButton* >           mySelBtn;
144   QMap< int, QLineEdit* >             mySelEdit;
145   QMap< int, QLabel* >                mySelLbl;
146
147   QLineEdit*                          myName;
148   QPushButton*                        myOpenBtn;
149   QPushButton*                        myNewBtn;
150
151   QCheckBox*                          myReverseChk;
152   QCheckBox*                          myCreatePolygonsChk;
153   QCheckBox*                          myCreatePolyedrsChk;
154   SMESHGUI_PatternWidget*             myPicture2d;
155   QFrame*                             myPicture3d;
156   QLabel*                             myPreview3d;
157
158   QCheckBox*                          myPreviewChk;
159
160   SMESHGUI*                           mySMESHGUI;
161   SVTK_Selector*                      mySelector;
162   LightApp_SelectionMgr*              mySelectionMgr;
163   int                                 mySelInput;
164   int                                 myNbPoints;
165   int                                 myType;
166   bool                                myIsCreateDlgOpen;
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   
173   SMESHGUI_CreatePatternDlg*          myCreationDlg;
174   SMESH::SMESH_Pattern_var            myPattern;
175   SALOME_Actor*                       myPreviewActor;
176
177   QString                             myHelpFileName;
178 };
179
180 #endif