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;
48 int myHexesMinLevel, myHexesMaxLevel;
49 double myMinSize, myMaxSize;
50 bool myHexoticInvalidElements;
51 bool myHexoticIgnoreRidges;
52 double myHexoticSharpAngleThreshold;
54 QString myHexoticWorkingDir;
55 int myHexoticVerbosity;
56 int myHexoticMaxMemory;
58 QString myTextOptions;
59 HexoticPlugin_Hypothesis::THexoticSizeMaps mySizeMaps;
61 double myFirstLayerSize;
64 std::vector<int> myFacesWithLayers;
65 std::vector<int> myImprintedFaces;
66 } HexoticHypothesisData;
69 * \brief Class for creation of MG-Hexa hypotheses
71 class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
76 HexoticPluginGUI_HypothesisCreator( const QString& );
77 virtual ~HexoticPluginGUI_HypothesisCreator();
79 virtual bool checkParams(QString&) const;
80 virtual QString helpPage() const;
83 virtual QFrame* buildFrame ();
84 virtual void retrieveParams() const;
85 virtual QString storeParams () const;
87 virtual QString caption() const;
88 virtual QPixmap icon() const;
89 virtual QString type() const;
92 bool readParamsFromHypo( HexoticHypothesisData& ) const;
93 bool readParamsFromWidgets( HexoticHypothesisData& ) const;
94 bool readSizeMapsFromWidgets( HexoticHypothesisData& ) const;
95 void insertLocalSizeInWidget( std::string entry, std::string shapeName, double size, int row ) const;
96 bool storeParamsToHypo( const HexoticHypothesisData& ) const;
97 void resizeEvent(QResizeEvent *event);
98 void printData(HexoticHypothesisData&) const;
100 GEOM::GEOM_Object_var entryToObject( std::string entry) const;
104 // QWidget* myStdGroup;
106 HexoticPluginGUI_StdWidget* myStdWidget;
107 HexoticPluginGUI_SizeMapsWidget* mySmpWidget;
108 HexoticPluginGUI_ViscousLayersWidget* myVLWidget;
109 StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg;
112 std::vector< std::string > mySizeMapsToRemove;
113 QVariant myNotModifiedSize;
116 void onAddLocalSize();
117 void onRemoveLocalSize();
118 void onTabChanged(int);
122 class SizeMapsTableWidgetDelegate : public QItemDelegate
127 SizeMapsTableWidgetDelegate(QObject *parent = 0);
129 QWidget *createEditor(QWidget *parent,
130 const QStyleOptionViewItem &option,
131 const QModelIndex &index) const;
133 void setEditorData(QWidget *editor,
134 const QModelIndex &index) const;
136 void setModelData(QWidget *editor,
137 QAbstractItemModel *model,
138 const QModelIndex &index) const;
140 void updateEditorGeometry(QWidget *editor,
141 const QStyleOptionViewItem &option,
142 const QModelIndex &index) const;