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