Salome HOME
SMH: Preparation version 3.0.0 - merge (HEAD+POLYWORK)
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_CreatePatternDlg.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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
19 //
20 //
21 //
22 //  File   : SMESHGUI_CreatePatternDlg.h
23 //  Author : Sergey LITONIN
24 //  Module : SMESH
25
26
27 #ifndef SMESHGUI_CreatePatternDlg_H
28 #define SMESHGUI_CreatePatternDlg_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 SMESHGUI_PatternWidget;
39 class SALOMEDSClient_SObject;
40
41 class QCloseEvent;
42 class QFrame;
43 class QLineEdit;
44 class SMESHGUI_SpinBox;
45 class QPushButton;
46 class SalomeApp_SelectionMgr;
47 class QRadioButton;
48 class QCheckBox;
49 class QButtonGroup;
50 class QLabel;
51 class SVTK_ViewWindow;
52 class SVTK_Selector;
53 class SMESHGUI;
54
55 /*!
56  *  Class       : SMESHGUI_CreatePatternDlg
57  *  Description : Dialog to specify filters for VTK viewer
58  */
59
60 class SMESHGUI_CreatePatternDlg : public QDialog
61 {
62   Q_OBJECT
63
64 public:
65   enum { Type_2d, Type_3d };
66
67 public:
68                            SMESHGUI_CreatePatternDlg( SMESHGUI*,
69                                                       const int,
70                                                       const char* = 0);
71   virtual                  ~SMESHGUI_CreatePatternDlg();
72
73   void                     Init(const int);
74   QString                  GetPatternName() const;
75   SMESH::SMESH_Pattern_ptr GetPattern();
76   void                     SetMesh (SMESH::SMESH_Mesh_ptr);
77
78 signals:
79
80   void                     NewPattern();
81   void                     Close();
82
83 private:
84
85   void                     closeEvent (QCloseEvent* e);
86   void                     enterEvent (QEvent*);
87
88 private slots:
89
90   void                     onOk();
91   void                     onSave();
92   void                     onClose();
93
94   void                     onDeactivate();
95
96   void                     onSelectionDone();
97   void                     onTypeChanged (int);
98   void                     onProject (bool);
99   void                     onSelBtnClicked();
100
101 private:
102
103   QFrame*                  createButtonFrame (QWidget*);
104   QFrame*                  createMainFrame   (QWidget*);
105   void                     displayPreview();
106   void                     erasePreview();
107   void                     activateSelection();
108   QString                  autoExtension (const QString& theFileName) const;
109   bool                     isValid();
110   bool                     loadFromObject (const bool = true);
111   QString                  getDefaultName() const;
112   GEOM::GEOM_Object_ptr    getGeom (SALOMEDSClient_SObject*) const;
113
114 private:
115
116   QPushButton*             myOkBtn;
117   QPushButton*             mySaveBtn;
118   QPushButton*             myCloseBtn;
119
120   QButtonGroup*            myTypeGrp;
121   QRadioButton*            mySwitch2d;
122   QRadioButton*            mySwitch3d;
123   QRadioButton*            mySwitchSMESH_Pattern3d;
124
125   QLineEdit*               myMeshEdit;
126   QLineEdit*               myName;
127
128   SMESHGUI_PatternWidget*  myPicture2d;
129
130   QCheckBox*               myProjectChk;
131
132   SMESHGUI*                mySMESHGUI;
133   SVTK_ViewWindow*         myViewWindow;
134   SVTK_Selector*           mySelector;
135   SalomeApp_SelectionMgr*  mySelectionMgr;
136   int                      myNbPoints;
137   int                      myType;
138
139   SMESH::SMESH_Mesh_var    myMesh;
140   SMESH::SMESH_subMesh_var mySubMesh;
141   GEOM::GEOM_Object_var    myGeomObj;
142
143   SMESH::SMESH_Pattern_var myPattern;
144   bool                     myIsLoaded;
145 };
146
147 #endif