Salome HOME
23368: [CEA 1865] Possibility to define faces to mesh as a single one: transpatch...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Make2DFrom3DOp.h
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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 #include "SMESH_TypeFilter.hxx"
30
31 #include <SALOMEconfig.h>
32 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
33 #include CORBA_SERVER_HEADER(SMESH_Mesh)
34
35 class QCheckBox;
36 class QLineEdit;
37 class QRadioButton;
38 class SMESHGUI_Make2DFrom3DOp;
39
40 /*!
41  * \brief Dialog to show result mesh statistic
42  */
43
44 class SMESHGUI_EXPORT SMESHGUI_Make2DFrom3DDlg :  public SMESHGUI_Dialog
45 {
46   Q_OBJECT
47
48 public:
49   enum { MeshOrGroups };
50
51   SMESHGUI_Make2DFrom3DDlg( QWidget* );
52   virtual ~SMESHGUI_Make2DFrom3DDlg();
53
54   SMESH::Bnd_Dimension mode() const;
55
56   bool                 needNewMesh() const;
57   QString              getNewMeshName() const;
58   void                 setNewMeshName( const QString& );
59   void                 setNewMeshEnabled( bool );
60   bool                 getNewMeshEnabled() const;
61
62   bool                 needGroup() const;
63   QString              getGroupName() const;
64   void                 setGroupName( const QString& );
65
66   bool                 copySource() const;
67
68 private slots:
69   void                 onTargetChanged();
70   void                 onGroupChecked();
71
72 private:
73   QRadioButton* my2dFrom3dRB;
74   QRadioButton* my1dFrom2dRB;
75   QRadioButton* my1dFrom3dRB;
76   QRadioButton* myThisMeshRB;
77   QRadioButton* myNewMeshRB;
78   QLineEdit*    myMeshName;
79   QCheckBox*    myCopyCheck;
80   QCheckBox*    myGroupCheck;
81   QLineEdit*    myGroupName;
82
83   friend class SMESHGUI_Make2DFrom3DOp;
84 };
85
86 /*!
87  * \brief Operation to compute 2D mesh on 3D
88  */
89
90 class SMESHGUI_EXPORT SMESHGUI_Make2DFrom3DOp : public SMESHGUI_SelectionOp
91 {
92   Q_OBJECT
93
94 public:
95   SMESHGUI_Make2DFrom3DOp();
96   virtual ~SMESHGUI_Make2DFrom3DOp();
97
98   virtual LightApp_Dialog*           dlg() const;
99
100 protected:
101   virtual void                       startOperation();
102   virtual void                       selectionDone();
103   virtual SUIT_SelectionFilter*      createFilter( const int ) const;
104   bool                               isValid( QString& ) const;
105
106 protected slots:
107   virtual bool                       onApply();
108   void                               onModeChanged();
109
110 private:
111   bool                               compute2DMesh( QStringList& );
112
113 private:
114   SMESH::SMESH_Mesh_var              mySrcMesh;
115   QPointer<SMESHGUI_Make2DFrom3DDlg> myDlg;
116
117   SMESH_TypeFilter                   myMeshFilter;
118   SMESH_TypeFilter                   myGroupFilter;
119 };
120
121 #endif // SMESHGUI_Make2DFrom3DOp_H