1 // Copyright (C) 2007-2015 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 HexoticPlugin_Hypothesis::THexoticSizeMaps mySizeMaps;
60 double myFirstLayerSize;
63 std::vector<int> myFacesWithLayers;
64 std::vector<int> myImprintedFaces;
65 } HexoticHypothesisData;
68 * \brief Class for creation of MG-Hexa hypotheses
70 class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
75 HexoticPluginGUI_HypothesisCreator( const QString& );
76 virtual ~HexoticPluginGUI_HypothesisCreator();
78 virtual bool checkParams(QString&) const;
79 virtual QString helpPage() const;
82 virtual QFrame* buildFrame ();
83 virtual void retrieveParams() const;
84 virtual QString storeParams () const;
86 virtual QString caption() const;
87 virtual QPixmap icon() const;
88 virtual QString type() const;
91 bool readParamsFromHypo( HexoticHypothesisData& ) const;
92 bool readParamsFromWidgets( HexoticHypothesisData& ) const;
93 bool readSizeMapsFromWidgets( HexoticHypothesisData& ) const;
94 void insertLocalSizeInWidget( std::string entry, std::string shapeName, double size, int row ) const;
95 bool storeParamsToHypo( const HexoticHypothesisData& ) const;
96 void resizeEvent(QResizeEvent *event);
97 void printData(HexoticHypothesisData&) const;
99 GEOM::GEOM_Object_var entryToObject( std::string entry) const;
103 // QWidget* myStdGroup;
105 HexoticPluginGUI_StdWidget* myStdWidget;
106 HexoticPluginGUI_SizeMapsWidget* mySmpWidget;
107 HexoticPluginGUI_ViscousLayersWidget* myVLWidget;
108 StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg;
111 std::vector< std::string > mySizeMapsToRemove;
112 QVariant myNotModifiedSize;
115 void onAddLocalSize();
116 void onRemoveLocalSize();
117 void onTabChanged(int);
121 class SizeMapsTableWidgetDelegate : public QItemDelegate
126 SizeMapsTableWidgetDelegate(QObject *parent = 0);
128 QWidget *createEditor(QWidget *parent,
129 const QStyleOptionViewItem &option,
130 const QModelIndex &index) const;
132 void setEditorData(QWidget *editor,
133 const QModelIndex &index) const;
135 void setModelData(QWidget *editor,
136 QAbstractItemModel *model,
137 const QModelIndex &index) const;
139 void updateEditorGeometry(QWidget *editor,
140 const QStyleOptionViewItem &option,
141 const QModelIndex &index) const;