Salome HOME
Fix bug 12796: Warning missed for the bad file 'test18.med'
[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   void                                keyPressEvent(QKeyEvent*);
118   bool                                isValid( const bool theMess = true );
119   void                                resetSelInput();
120   bool                                isRefine() const;
121
122   bool                                getIds( QValueList<int>& ) const;
123   int                                 getNode( bool = false ) const;
124
125 private:
126
127   QPushButton*                        myOkBtn;
128   QPushButton*                        myApplyBtn;
129   QPushButton*                        myCloseBtn;
130   QPushButton*                        myHelpBtn;
131
132   QButtonGroup*                       myTypeGrp;
133   QRadioButton*                       mySwitch2d;
134   QRadioButton*                       mySwitch3d;
135
136   QCheckBox*                          myRefine;
137
138   QFrame*                             myRefineGrp;
139   QSpinBox*                           myNode1;
140   QSpinBox*                           myNode2;
141   QLabel*                             myNode2Lbl;
142
143   QGroupBox*                          myGeomGrp;
144   QMap< int, QPushButton* >           mySelBtn;
145   QMap< int, QLineEdit* >             mySelEdit;
146   QMap< int, QLabel* >                mySelLbl;
147
148   QLineEdit*                          myName;
149   QPushButton*                        myOpenBtn;
150   QPushButton*                        myNewBtn;
151
152   QCheckBox*                          myReverseChk;
153   QCheckBox*                          myCreatePolygonsChk;
154   QCheckBox*                          myCreatePolyedrsChk;
155   SMESHGUI_PatternWidget*             myPicture2d;
156   QFrame*                             myPicture3d;
157   QLabel*                             myPreview3d;
158
159   QCheckBox*                          myPreviewChk;
160
161   SMESHGUI*                           mySMESHGUI;
162   SVTK_Selector*                      mySelector;
163   LightApp_SelectionMgr*              mySelectionMgr;
164   int                                 mySelInput;
165   int                                 myNbPoints;
166   int                                 myType;
167   bool                                myIsCreateDlgOpen;
168   bool                                myBusy;
169
170   SMESH::SMESH_Mesh_var               myMesh;
171   GEOM::GEOM_Object_var               myMeshShape;
172   QMap< int, GEOM::GEOM_Object_var >  myGeomObj;
173   
174   SMESHGUI_CreatePatternDlg*          myCreationDlg;
175   SMESH::SMESH_Pattern_var            myPattern;
176   SALOME_Actor*                       myPreviewActor;
177
178   QString                             myHelpFileName;
179 };
180
181 #endif