Salome HOME
[EDF] (2022-T3) Creation of 3D mesh with GMSH based on 2D mesh created with another...
[plugins/gmshplugin.git] / src / GUI / GMSHPluginGUI_HypothesisCreator.h
1 // Copyright (C) 2012-2015  ALNEOS
2 // Copyright (C) 2016-2022  EDF R&D
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, or (at your option) any later version.
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.alneos.com/ or email : contact@alneos.fr
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 #ifndef GMSHPLUGINGUI_HypothesisCreator_HeaderFile
22 #define GMSHPLUGINGUI_HypothesisCreator_HeaderFile
23
24 #include "GmshVersion.h"
25 #include "GMSHPluginGUI.h"
26
27 #include <SMESHGUI_Hypotheses.h>
28
29 #include <TopAbs_ShapeEnum.hxx>
30
31 #include <QSet>
32
33 class SMESHGUI_SpinBox;
34 class GeomSelectionTools;
35 class QComboBox;
36 class QCheckBox;
37 class QLineEdit;
38 class QTableWidget;
39
40 typedef struct
41 {
42   QString             myName;
43   int                 my2DAlgo,my3DAlgo,myRecomb2DAlgo;
44   bool                myRecombineAll;
45   int                 mySubdivAlgo,myRemeshAlgo,myRemeshPara,mySmouthSteps;
46   bool                myUseIncomplElem;
47   bool                mySecondOrder;
48 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
49   double              mySizeFactor,myMaxSize, myMinSize, myMeshCurvatureSize;
50   QString             myMaxSizeVar, myMinSizeVar, mySmouthStepsVar, mySizeFactorVar, myMeshCurvatureSizeVar;
51 #else
52   double              mySizeFactor,myMaxSize, myMinSize;
53   QString             myMaxSizeVar, myMinSizeVar, mySmouthStepsVar, mySizeFactorVar;
54 #endif
55   mutable QString     myErrorMsg;
56 } GmshHypothesisData;
57
58 /*!
59  * \brief Class for creation of GMSH2D and GMSH3D hypotheses
60 */
61 class GMSHPLUGIN_GUI_EXPORT GMSHPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
62 {
63   Q_OBJECT
64
65 public:
66   GMSHPluginGUI_HypothesisCreator( const QString& );
67   virtual ~GMSHPluginGUI_HypothesisCreator();
68
69   virtual bool     checkParams(QString& msg) const;
70   virtual QString  helpPage() const;
71
72 protected:
73   virtual QFrame*  buildFrame    ();
74   virtual void     retrieveParams() const;
75   virtual QString  storeParams   () const;
76   
77   virtual QString  caption() const;
78   virtual QPixmap  icon() const;
79   virtual QString  type() const;
80
81 protected slots:
82   void               updateWidgets();
83   virtual void       onAddCompound();
84   virtual void       onRemoveCompound();
85   
86 private:
87   bool readParamsFromHypo( GmshHypothesisData& ) const;
88   bool readParamsFromWidgets( GmshHypothesisData& ) const;
89   bool storeParamsToHypo( const GmshHypothesisData& ) const;
90   GeomSelectionTools* getGeomSelectionTools();
91
92 private:
93  QLineEdit*        myName;
94  QComboBox*        my2DAlgo;
95  QComboBox*        my3DAlgo;
96  QComboBox*        myRecomb2DAlgo;
97  QCheckBox*        myRecombineAll;
98  QComboBox*        mySubdivAlgo;
99  QComboBox*        myRemeshAlgo;
100  QComboBox*        myRemeshPara;
101  SMESHGUI_SpinBox* mySmouthSteps;
102  SMESHGUI_SpinBox* mySizeFactor;
103 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
104  SMESHGUI_SpinBox* myMeshCurvatureSize;
105 #endif
106  SMESHGUI_SpinBox* myMaxSize;
107  SMESHGUI_SpinBox* myMinSize;
108  QCheckBox*        myUseIncomplElem;
109  QCheckBox*        mySecondOrder;
110  bool myIs2D;
111  bool myIs3D;
112
113  QTableWidget* myCompoundTable;
114  GeomSelectionTools* myGeomSelectionTools;
115  QSet<QString> myCompoundSet;
116  QSet<QString> myCompoundToRemove;
117 };
118
119 #endif