Salome HOME
Merge from V6_3_BR 06/06/2011
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Make2DFrom3DOp.h
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File   : SMESHGUI_Make2DFrom3D.h
20 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
21
22 #ifndef SMESHGUI_Make2DFrom3DOp_H
23 #define SMESHGUI_Make2DFrom3DOp_H
24
25 // SMESH includes
26 #include "SMESH_SMESHGUI.hxx"
27 #include "SMESHGUI_Dialog.h"
28 #include "SMESHGUI_SelectionOp.h"
29
30 #include <SALOMEconfig.h>
31 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
32 #include CORBA_SERVER_HEADER(SMESH_Mesh)
33
34 class QCheckBox;
35 class QLineEdit;
36 class QRadioButton;
37 class SMESHGUI_Make2DFrom3DOp;
38
39 /*!
40  * \brief Dialog to show result mesh statistic
41  */
42
43 class SMESHGUI_EXPORT SMESHGUI_Make2DFrom3DDlg :  public SMESHGUI_Dialog
44 {
45   Q_OBJECT
46
47 public:
48   enum { Mesh, Groups };
49
50   SMESHGUI_Make2DFrom3DDlg( QWidget* );
51   virtual ~SMESHGUI_Make2DFrom3DDlg();
52
53   SMESH::Bnd_Dimension mode() const;
54
55   bool                 needNewMesh() const;
56   QString              getNewMeshName() const;
57   void                 setNewMeshName( const QString& );
58
59   bool                 needGroup() const;
60   QString              getGroupName() const;
61   void                 setGroupName( const QString& );
62
63   bool                 copySource() const;
64
65 private slots:
66   void                 onTargetChanged();
67   void                 onGroupChecked();
68
69 private:
70   QRadioButton* my2dFrom3dRB;
71   QRadioButton* my1dFrom2dRB;
72   QRadioButton* my1dFrom3dRB;
73   QRadioButton* myThisMeshRB;
74   QRadioButton* myNewMeshRB;
75   QLineEdit*    myMeshName;
76   QCheckBox*    myCopyCheck;
77   QCheckBox*    myGroupCheck;
78   QLineEdit*    myGroupName;
79
80   friend class SMESHGUI_Make2DFrom3DOp;
81 };
82
83 /*!
84  * \brief Operation to compute 2D mesh on 3D
85  */
86
87 class SMESHGUI_EXPORT SMESHGUI_Make2DFrom3DOp : public SMESHGUI_SelectionOp
88 {
89   Q_OBJECT
90
91 public:
92   SMESHGUI_Make2DFrom3DOp();
93   virtual ~SMESHGUI_Make2DFrom3DOp();
94
95   virtual LightApp_Dialog*           dlg() const;
96
97 protected:
98   virtual void                       startOperation();
99   virtual void                       selectionDone();
100   virtual SUIT_SelectionFilter*      createFilter( const int ) const;
101   bool                               isValid( QString& ) const;
102
103 protected slots:
104   virtual bool                       onApply();
105   void                               onModeChanged();
106
107 private:
108   bool                               compute2DMesh( QStringList& );
109
110 private:
111   SMESH::SMESH_Mesh_var              mySrcMesh;
112   QPointer<SMESHGUI_Make2DFrom3DDlg> myDlg;
113 };
114
115 #endif // SMESHGUI_Make2DFrom3DOp_H