1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 : HexoticPluginGUI_HypothesisCreator.h
22 // Author : Lioka RAZAFINDRAZAKA (CEA)
25 #ifndef HexoticPLUGINGUI_HypothesisCreator_H
26 #define HexoticPLUGINGUI_HypothesisCreator_H
28 #include "HexoticPluginGUI.h"
30 #include <SMESHGUI_Hypotheses.h>
31 #include "StdMeshersGUI_ObjectReferenceParamWdg.h"
32 #include "HexoticPlugin_Hypothesis.hxx"
34 #include <QItemDelegate>
39 class QTableWidgetItem;
41 class HexoticPluginGUI_StdWidget;
42 class HexoticPluginGUI_SizeMapsWidget;
43 class HexoticPluginGUI_ViscousLayersWidget;
44 class SMESH_AdvOptionsWdg;
49 int myHexesMinLevel, myHexesMaxLevel;
50 double myMinSize, myMaxSize;
51 bool myHexoticInvalidElements;
52 bool myHexoticIgnoreRidges;
53 double myHexoticSharpAngleThreshold;
55 QString myHexoticWorkingDir;
56 int myHexoticVerbosity;
57 int myHexoticMaxMemory;
59 QString myTextOptions;
60 HexoticPlugin_Hypothesis::THexoticSizeMaps mySizeMaps;
62 double myFirstLayerSize;
65 std::vector<int> myFacesWithLayers;
66 std::vector<int> myImprintedFaces;
67 } HexoticHypothesisData;
70 * \brief Class for creation of MG-Hexa hypotheses
72 class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
77 HexoticPluginGUI_HypothesisCreator( const QString& );
78 virtual ~HexoticPluginGUI_HypothesisCreator();
80 virtual bool checkParams(QString&) const;
81 virtual QString helpPage() const;
84 virtual QFrame* buildFrame ();
85 virtual void retrieveParams() const;
86 virtual QString storeParams () const;
88 virtual QString caption() const;
89 virtual QPixmap icon() const;
90 virtual QString type() const;
93 bool readParamsFromHypo( HexoticHypothesisData& ) const;
94 bool readParamsFromWidgets( HexoticHypothesisData& ) const;
95 bool readSizeMapsFromWidgets( HexoticHypothesisData& ) const;
96 void insertLocalSizeInWidget( std::string entry, std::string shapeName, double size, int row ) const;
97 bool storeParamsToHypo( const HexoticHypothesisData& ) const;
98 void resizeEvent(QResizeEvent *event);
99 void printData(HexoticHypothesisData&) const;
101 GEOM::GEOM_Object_var entryToObject( std::string entry) const;
105 // QWidget* myStdGroup;
107 HexoticPluginGUI_StdWidget* myStdWidget;
108 SMESH_AdvOptionsWdg* myAdvWidget;
109 HexoticPluginGUI_SizeMapsWidget* mySmpWidget;
110 HexoticPluginGUI_ViscousLayersWidget* myVLWidget;
111 StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg;
114 std::vector< std::string > mySizeMapsToRemove;
115 QVariant myNotModifiedSize;
118 void onAddLocalSize();
119 void onRemoveLocalSize();
120 void onTabChanged(int);
124 class SizeMapsTableWidgetDelegate : public QItemDelegate
129 SizeMapsTableWidgetDelegate(QObject *parent = 0);
131 QWidget *createEditor(QWidget *parent,
132 const QStyleOptionViewItem &option,
133 const QModelIndex &index) const;
135 void setEditorData(QWidget *editor,
136 const QModelIndex &index) const;
138 void setModelData(QWidget *editor,
139 QAbstractItemModel *model,
140 const QModelIndex &index) const;
142 void updateEditorGeometry(QWidget *editor,
143 const QStyleOptionViewItem &option,
144 const QModelIndex &index) const;