Salome HOME
remove images in ascii
[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 "SMESH_SMESHGUI.hxx"
31
32 #include <qdialog.h>
33
34 // IDL Headers
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(GEOM_Gen)
37 #include CORBA_SERVER_HEADER(SMESH_Mesh)
38 #include CORBA_SERVER_HEADER(SMESH_Pattern)
39
40 class QCloseEvent;
41 class QFrame;
42 class QLineEdit;
43 class SMESHGUI_SpinBox;
44 class QPushButton;
45 class LightApp_SelectionMgr;
46 class QRadioButton;
47 class QCheckBox;
48 class QButtonGroup;
49 class QLabel;
50 class QSpinBox;
51 class QGroupBox;
52 class SMESHGUI_CreatePatternDlg;
53 class SMESHGUI_PatternWidget;
54 class vtkUnstructuredGrid;
55 class SALOME_Actor;
56 class SVTK_ViewWindow;
57 class SVTK_Selector;
58 class SMESHGUI;
59
60 /*
61   Class       : SMESHGUI_MeshPatternDlg
62   Description : Dialog to specify filters for VTK viewer
63 */
64
65 class SMESHGUI_EXPORT SMESHGUI_MeshPatternDlg : public QDialog
66 {
67   Q_OBJECT
68
69   // Pattern type
70   enum { Type_2d, Type_3d };
71
72   // selection input
73   enum { Mesh, Object, Vertex1, Vertex2, Ids };
74
75 public:
76                                       SMESHGUI_MeshPatternDlg( SMESHGUI*,
77                                                                const char* = 0 );
78   virtual                             ~SMESHGUI_MeshPatternDlg();
79
80   void                                Init();
81   
82 private slots:
83
84   void                                onOk();
85   bool                                onApply();
86   void                                onClose();
87   void                                onHelp();
88
89   void                                onDeactivate();
90
91   void                                onSelectionDone();
92   void                                onSelInputChanged();
93
94   void                                onTypeChanged( int );
95   void                                onModeToggled( bool );
96   void                                onOpen();
97   void                                onNew();
98   void                                onReverse( bool );
99   void                                onPreview( bool );
100   void                                onOkCreationDlg();
101   void                                onCloseCreationDlg();
102   void                                onTextChanged( const QString& );
103   void                                onNodeChanged( int value );
104
105 private:
106
107   QFrame*                             createButtonFrame( QWidget* );
108   QFrame*                             createMainFrame  ( QWidget* );
109   void                                displayPreview();
110   vtkUnstructuredGrid*                getGrid();
111   void                                erasePreview();
112   void                                updateWgState();
113   bool                                loadFromFile( const QString& );
114   void                                activateSelection();
115   QStringList                         prepareFilters() const;
116   QString                             autoExtension( const QString& theFileName ) const;
117   void                                closeEvent( QCloseEvent* e ) ;
118   void                                enterEvent ( QEvent * ) ;
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