1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : BLSURFPluginGUI_HypothesisCreator.h
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 // & Aurelien ALLEAUME (DISTENE)
24 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
27 #ifndef BLSURFPLUGINGUI_HypothesisCreator_H
28 #define BLSURFPLUGINGUI_HypothesisCreator_H
31 #if defined BLSURFPLUGIN_GUI_EXPORTS || defined BLSURFPluginGUI_EXPORTS
32 #define BLSURFPLUGIN_GUI_EXPORT __declspec( dllexport )
34 #define BLSURFPLUGIN_GUI_EXPORT __declspec( dllimport )
37 #define BLSURFPLUGIN_GUI_EXPORT
41 // E.A. : On windows with python 2.6, there is a conflict
42 // E.A. : between pymath.h and Standard_math.h which define
43 // E.A. : some same symbols : acosh, asinh, ...
44 #include <Standard_math.hxx>
50 #include <QItemDelegate>
52 #include <SMESHGUI_Hypotheses.h>
53 #include <SALOMEconfig.h>
58 #include <TopAbs_ShapeEnum.hxx>
59 #include <GeomSelectionTools.h>
60 #include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm)
72 class QTreeWidgetItem;
74 class SMESHGUI_SpinBox;
75 class LightApp_SelectionMgr;
76 // class DlgBlSurfHyp_Enforced;
80 int myTopology, myVerbosity;
81 int myPhysicalMesh, myGeometricMesh;
82 double myAngleMeshS, myAngleMeshC, myGradation;
83 double myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax;
84 bool myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex;
85 std::set<std::vector<double> > enfVertexList;
86 std::map<std::string, std::set<std::vector<double> > > entryEnfVertexListMap;
88 std::map<std::string, std::set<std::vector<double> > > groupNameEnfVertexListMap;
89 std::map<std::vector<double> , std::string > enfVertexGroupNameMap;
92 } BlsurfHypothesisData;
96 * \brief Class for creation of BLSURF hypotheses
98 class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
103 BLSURFPluginGUI_HypothesisCreator( const QString& );
104 virtual ~BLSURFPluginGUI_HypothesisCreator();
106 virtual bool checkParams() const;
107 virtual QString helpPage() const;
108 void insertElementType( TopAbs_ShapeEnum );
109 static LightApp_SelectionMgr* selectionMgr();
112 virtual QFrame* buildFrame ();
113 virtual void retrieveParams() const;
114 virtual QString storeParams () const;
116 virtual QString caption() const;
117 virtual QPixmap icon() const;
118 virtual QString type() const;
121 void onPhysicalMeshChanged();
122 void onGeometricMeshChanged();
124 void onDeleteOption();
125 void onOptionChosenInPopup( QAction* );
126 // void onAddAttractor();
127 void onAddMapOnSurface();
128 void onAddMapOnEdge();
129 void onAddMapOnPoint();
131 void onSetSizeMap(int,int);
134 void addEnforcedVertex(std::string, std::string, double, double, double, std::string);
136 void addEnforcedVertex(std::string, std::string, double, double, double);
137 void onAddEnforcedVertices();
138 void onRemoveEnforcedVertex();
139 void synchronizeCoords();
140 void update(QTreeWidgetItem* , int );
143 bool readParamsFromHypo( BlsurfHypothesisData& ) const;
144 QString readParamsFromWidgets( BlsurfHypothesisData& ) const;
145 bool storeParamsToHypo( const BlsurfHypothesisData& ) const;
146 bool sizeMapsValidation();
147 bool sizeMapValidationFromRow(int,bool displayError = true);
148 bool sizeMapValidationFromEntry(QString,bool displayError = true);
149 GeomSelectionTools* getGeomSelectionTool();
154 QComboBox* myPhysicalMesh;
155 SMESHGUI_SpinBox* myPhySize;
156 SMESHGUI_SpinBox* myPhyMin;
157 SMESHGUI_SpinBox* myPhyMax;
158 QComboBox* myGeometricMesh;
159 SMESHGUI_SpinBox* myAngleMeshS;
160 SMESHGUI_SpinBox* myAngleMeshC;
161 SMESHGUI_SpinBox* myGeoMin;
162 SMESHGUI_SpinBox* myGeoMax;
163 SMESHGUI_SpinBox* myGradation;
164 QCheckBox* myAllowQuadrangles;
165 QCheckBox* myDecimesh;
168 QComboBox* myTopology;
169 QSpinBox* myVerbosity;
170 QTableWidget* myOptionTable;
173 QTableWidget *mySizeMapTable;
174 QPushButton *addAttractorButton;
175 QPushButton *addSurfaceButton;
176 QPushButton *addEdgeButton;
177 QPushButton *addPointButton;
178 QPushButton *removeButton;
181 /* TODO FACE AND VERTEX SELECTION
182 QPushButton* selectFaceButton;
183 QLineEdit* mySelectedFace;
184 // GEOM::GEOM_Object_var myEnfFace;
185 QPushButton* selectVertexButton;
186 QLineEdit* mySelectedEnforcedVertex;
187 // GEOM::GEOM_Object_var myEnfVertex;
189 // DlgBlSurfHyp_Enforced* myEnforcedVertexWidget;
190 QTreeWidget* myEnforcedTreeWidget;
191 SMESHGUI_SpinBox* myXCoord;
192 SMESHGUI_SpinBox* myYCoord;
193 SMESHGUI_SpinBox* myZCoord;
195 QLineEdit* myGroupName;
196 QGroupBox* makeGroupsCheck;
197 QLineEdit* myGlobalGroupName;
199 QPushButton* addVertexButton;
200 QPushButton* removeVertexButton;
202 // map = entry , size map
203 QMap<QString, QString> mySMPMap;
204 QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
205 GeomSelectionTools* GeomToolSelected;
206 LightApp_SelectionMgr* aSel;
208 BLSURFPlugin::string_array_var myOptions;
211 PyObject * main_dict;
215 class EnforcedTreeWidgetDelegate : public QItemDelegate
220 EnforcedTreeWidgetDelegate(QObject *parent = 0);
222 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
223 const QModelIndex &index) const;
225 void setEditorData(QWidget *editor, const QModelIndex &index) const;
226 void setModelData(QWidget *editor, QAbstractItemModel *model,
227 const QModelIndex &index) const;
229 void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
230 const QModelIndex &index) const;
232 bool vertexExists(QAbstractItemModel *model, const QModelIndex &index, QString value) const;
235 #endif // BLSURFPLUGINGUI_HypothesisCreator_H