]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - src/GUI/BLSURFPluginGUI_HypothesisCreator.h
Salome HOME
First version of SizeMap for BLSurf :
[plugins/blsurfplugin.git] / src / GUI / BLSURFPluginGUI_HypothesisCreator.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
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 // ---
20 // File    : BLSURFPluginGUI_HypothesisCreator.h
21 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
22 //           & Aurelien ALLEAUME (DISTENE)
23 // ---
24 //
25 #ifndef BLSURFPLUGINGUI_HypothesisCreator_H
26 #define BLSURFPLUGINGUI_HypothesisCreator_H
27
28 #ifdef WIN32
29   #ifdef BLSURFPLUGIN_GUI_EXPORTS
30     #define BLSURFPLUGIN_GUI_EXPORT __declspec( dllexport )
31   #else
32     #define BLSURFPLUGIN_GUI_EXPORT __declspec( dllimport )
33   #endif
34 #else
35   #define BLSURFPLUGIN_GUI_EXPORT
36 #endif
37
38 #include <Python.h>
39 #include <SMESHGUI_Hypotheses.h>
40 #include <SALOMEconfig.h>
41 #include <cstring>
42 #include <map>
43 #include <TopAbs_ShapeEnum.hxx>
44 #include <GeomSelectionTools.h>
45 #include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm)
46
47 class QGroupBox;
48 class QtxDoubleSpinBox;
49 class QComboBox;
50 class QCheckBox;
51 class QLineEdit;
52 class QTableWidget;
53 class QTableView;
54 class QStandardItemModel;
55 class QStandardItem;
56 class QModelIndex;
57 class QSpinBox;
58 class QMenu;
59 class QAction;
60 class LightApp_SelectionMgr;
61
62 typedef struct
63 {
64   int     myTopology, myVerbosity;
65   int     myPhysicalMesh, myGeometricMesh;
66   double  myAngleMeshS, myAngleMeshC, myGradation;
67   QString myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax;
68   bool    myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint;
69   QString myName;
70 } BlsurfHypothesisData;
71
72
73 /*!
74  * \brief Class for creation of BLSURF hypotheses
75 */
76 class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
77 {
78   Q_OBJECT
79
80 public:
81   BLSURFPluginGUI_HypothesisCreator( const QString& );
82   virtual ~BLSURFPluginGUI_HypothesisCreator();
83
84   virtual bool     checkParams() const;
85   virtual QString  helpPage() const;
86   void             insertElementType( TopAbs_ShapeEnum );
87   static LightApp_SelectionMgr* selectionMgr();
88
89 protected:
90   virtual QFrame*  buildFrame    ();
91   virtual void     retrieveParams() const;
92   virtual QString  storeParams   () const;
93   
94   virtual QString  caption() const;
95   virtual QPixmap  icon() const;
96   virtual QString  type() const;
97
98 protected slots:
99   void             onPhysicalMeshChanged();
100   void             onGeometricMeshChanged();
101   void             onAddOption();
102   void             onDeleteOption();
103   void             onOptionChosenInPopup( QAction* );
104   void             onAddMapOnSurface();
105   void             onAddMapOnEdge();
106   void             onAddMapOnPoint();
107   void             onRemoveMap();
108   void             onSetSizeMap(int,int);
109
110 private:
111   bool             readParamsFromHypo( BlsurfHypothesisData& ) const;
112   QString          readParamsFromWidgets( BlsurfHypothesisData& ) const;
113   bool             storeParamsToHypo( const BlsurfHypothesisData& ) const;
114   bool             sizeMapsValidation();
115   bool             sizeMapValidationFromRow(int);
116   bool             sizeMapValidationFromEntry(QString);
117
118 private:
119   QWidget*            myStdGroup;
120   QLineEdit*          myName;
121   QComboBox*          myPhysicalMesh;
122   QLineEdit*          myPhySize;
123   QLineEdit*          myPhyMin;
124   QLineEdit*          myPhyMax;
125   QComboBox*          myGeometricMesh;
126   QtxDoubleSpinBox*   myAngleMeshS;
127   QtxDoubleSpinBox*   myAngleMeshC;
128   QLineEdit*          myGeoMin;
129   QLineEdit*          myGeoMax;
130   QtxDoubleSpinBox*   myGradation;
131   QCheckBox*          myAllowQuadrangles;
132   QCheckBox*          myDecimesh;
133
134   QWidget*            myAdvGroup;
135   QComboBox*          myTopology;
136   QSpinBox*           myVerbosity;
137   QTableWidget*       myOptionTable;
138
139   QWidget             *mySmpGroup;  
140   QTableWidget        *mySizeMapTable;
141   QPushButton         *addEdgeButton;
142   QPushButton         *addSurfaceButton;
143   QPushButton         *addPointButton;
144   QPushButton         *removeButton;
145
146   // map =  entry , size map
147   QMap<QString, QString> mySMPMap;
148   QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
149   GeomSelectionTools* GeomToolSelected;
150
151   BLSURFPlugin::string_array_var myOptions;
152
153   PyObject *          main_mod;
154   PyObject *          main_dict;
155 };
156
157 #endif // BLSURFPLUGINGUI_HypothesisCreator_H