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 SalomeApp_DoubleSpinBox;
75 class LightApp_SelectionMgr;
79 int myTopology, myVerbosity;
80 int myPhysicalMesh, myGeometricMesh;
81 double myAngleMeshS, myAngleMeshC, myGradation;
82 QString myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax;
83 bool myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex;
84 std::map<std::string, std::set<std::vector<double> > > enfVertMap;
86 } BlsurfHypothesisData;
90 * \brief Class for creation of BLSURF hypotheses
92 class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
97 BLSURFPluginGUI_HypothesisCreator( const QString& );
98 virtual ~BLSURFPluginGUI_HypothesisCreator();
100 virtual bool checkParams() const;
101 virtual QString helpPage() const;
102 void insertElementType( TopAbs_ShapeEnum );
103 static LightApp_SelectionMgr* selectionMgr();
106 virtual QFrame* buildFrame ();
107 virtual void retrieveParams() const;
108 virtual QString storeParams () const;
110 virtual QString caption() const;
111 virtual QPixmap icon() const;
112 virtual QString type() const;
115 void onPhysicalMeshChanged();
116 void onGeometricMeshChanged();
118 void onDeleteOption();
119 void onOptionChosenInPopup( QAction* );
120 // void onAddAttractor();
121 void onAddMapOnSurface();
122 void onAddMapOnEdge();
123 void onAddMapOnPoint();
125 void onSetSizeMap(int,int);
127 void addEnforcedVertex(std::string, std::string, double, double, double);
128 void onAddEnforcedVertices();
129 void onRemoveEnforcedVertex();
130 void synchronizeCoords();
131 void update(QTreeWidgetItem* , int );
134 bool readParamsFromHypo( BlsurfHypothesisData& ) const;
135 QString readParamsFromWidgets( BlsurfHypothesisData& ) const;
136 bool storeParamsToHypo( const BlsurfHypothesisData& ) const;
137 bool sizeMapsValidation();
138 bool sizeMapValidationFromRow(int,bool displayError = true);
139 bool sizeMapValidationFromEntry(QString,bool displayError = true);
140 GeomSelectionTools* getGeomSelectionTool();
145 QComboBox* myPhysicalMesh;
146 QLineEdit* myPhySize;
149 QComboBox* myGeometricMesh;
150 SalomeApp_DoubleSpinBox* myAngleMeshS;
151 SalomeApp_DoubleSpinBox* myAngleMeshC;
154 SalomeApp_DoubleSpinBox* myGradation;
155 QCheckBox* myAllowQuadrangles;
156 QCheckBox* myDecimesh;
159 QComboBox* myTopology;
160 QSpinBox* myVerbosity;
161 QTableWidget* myOptionTable;
164 QTableWidget *mySizeMapTable;
165 QPushButton *addAttractorButton;
166 QPushButton *addSurfaceButton;
167 QPushButton *addEdgeButton;
168 QPushButton *addPointButton;
169 QPushButton *removeButton;
172 QTreeWidget* myEnforcedTreeWidget;
176 QPushButton* addVertexButton;
177 QPushButton* removeVertexButton;
179 // map = entry , size map
180 QMap<QString, QString> mySMPMap;
181 QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
182 GeomSelectionTools* GeomToolSelected;
183 LightApp_SelectionMgr* aSel;
185 BLSURFPlugin::string_array_var myOptions;
188 PyObject * main_dict;
192 class EnforcedTreeWidgetDelegate : public QItemDelegate
197 EnforcedTreeWidgetDelegate(QObject *parent = 0);
199 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
200 const QModelIndex &index) const;
202 void setEditorData(QWidget *editor, const QModelIndex &index) const;
203 void setModelData(QWidget *editor, QAbstractItemModel *model,
204 const QModelIndex &index) const;
206 void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
207 const QModelIndex &index) const;
209 bool vertexExists(QAbstractItemModel *model, const QModelIndex &index, QString value) const;
212 #endif // BLSURFPLUGINGUI_HypothesisCreator_H