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