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