Salome HOME
Fixes:
[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 //           Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
24 // ---
25 //
26 #ifndef BLSURFPLUGINGUI_HypothesisCreator_H
27 #define BLSURFPLUGINGUI_HypothesisCreator_H
28
29 #ifdef WIN32
30   #ifdef BLSURFPLUGIN_GUI_EXPORTS
31     #define BLSURFPLUGIN_GUI_EXPORT __declspec( dllexport )
32   #else
33     #define BLSURFPLUGIN_GUI_EXPORT __declspec( dllimport )
34   #endif
35 #else
36   #define BLSURFPLUGIN_GUI_EXPORT
37 #endif
38
39 #include <Python.h>
40 #include <SMESHGUI_Hypotheses.h>
41 #include <SALOMEconfig.h>
42 #include <cstring>
43 #include <map>
44 #include <TopAbs_ShapeEnum.hxx>
45 #include <GeomSelectionTools.h>
46 #include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm)
47
48 class QGroupBox;
49 class QtxDoubleSpinBox;
50 class QComboBox;
51 class QCheckBox;
52 class QLineEdit;
53 class QTableWidget;
54 class QTableView;
55 class QModelIndex;
56 class QSpinBox;
57 class QMenu;
58 class QAction;
59 class LightApp_SelectionMgr;
60
61 typedef struct
62 {
63   int     myTopology, myVerbosity;
64   int     myPhysicalMesh, myGeometricMesh;
65   double  myAngleMeshS, myAngleMeshC, myGradation;
66   QString myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax;
67   bool    myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint;
68   QString myName;
69 } BlsurfHypothesisData;
70
71
72 /*!
73  * \brief Class for creation of BLSURF hypotheses
74 */
75 class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
76 {
77   Q_OBJECT
78
79 public:
80   BLSURFPluginGUI_HypothesisCreator( const QString& );
81   virtual ~BLSURFPluginGUI_HypothesisCreator();
82
83   virtual bool        checkParams() const;
84   virtual QString     helpPage() const;
85   void                insertElementType( TopAbs_ShapeEnum );
86   static LightApp_SelectionMgr* selectionMgr();
87
88 protected:
89   virtual QFrame*     buildFrame    ();
90   virtual void        retrieveParams() const;
91   virtual QString     storeParams   () const;
92   
93   virtual QString     caption() const;
94   virtual QPixmap     icon() const;
95   virtual QString     type() const;
96
97 protected slots:
98   void                onPhysicalMeshChanged();
99   void                onGeometricMeshChanged();
100   void                onAddOption();
101   void                onDeleteOption();
102   void                onOptionChosenInPopup( QAction* );
103   void                onAddMapOnSurface();
104   void                onAddMapOnEdge();
105   void                onAddMapOnPoint();
106   void                onRemoveMap();
107   void                onSetSizeMap(int,int);
108
109 private:
110   bool                readParamsFromHypo( BlsurfHypothesisData& ) const;
111   QString             readParamsFromWidgets( BlsurfHypothesisData& ) const;
112   bool                storeParamsToHypo( const BlsurfHypothesisData& ) const;
113   bool                sizeMapsValidation();
114   bool                sizeMapValidationFromRow(int,bool displayError = true);
115   bool                sizeMapValidationFromEntry(QString,bool displayError = true);
116   GeomSelectionTools* getGeomSelectionTool();
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         *addAttractorButton;
142   QPushButton         *addSurfaceButton;
143   QPushButton         *addEdgeButton;
144   QPushButton         *addPointButton;
145   QPushButton         *removeButton;
146
147   // map =  entry , size map
148   QMap<QString, QString>          mySMPMap;
149   QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
150   GeomSelectionTools*             GeomToolSelected;
151   LightApp_SelectionMgr*          aSel;
152
153   BLSURFPlugin::string_array_var myOptions;
154
155   PyObject *          main_mod;
156   PyObject *          main_dict;
157 };
158
159 #endif // BLSURFPLUGINGUI_HypothesisCreator_H