1 // Copyright (C) 2007-2019 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"
29 #include "HexoticPlugin_Hypothesis.hxx"
31 #include <SMESHGUI_Hypotheses.h>
32 #include <StdMeshersGUI_ObjectReferenceParamWdg.h>
33 #include <QItemDelegate>
35 #include CORBA_SERVER_HEADER(HexoticPlugin_Algorithm)
40 class QTableWidgetItem;
42 class HexoticPluginGUI_StdWidget;
43 class HexoticPluginGUI_AdvWidget;
44 class HexoticPluginGUI_SizeMapsWidget;
45 class HexoticPluginGUI_ViscousLayersWidget;
46 class SMESH_AdvOptionsWdg;
51 int myHexesMinLevel, myHexesMaxLevel;
52 double myMinSize, myMaxSize, myApproxAngle;
53 bool myHexoticInvalidElements;
54 bool myHexoticIgnoreRidges;
55 double myHexoticSharpAngleThreshold;
57 QString myHexoticWorkingDir;
58 int myHexoticVerbosity;
59 int myHexoticMaxMemory;
61 QString myTextOptions;
62 bool myKeepFiles,myLogInStandardOutput, myRemoveLogOnSuccess;
63 HexoticPlugin_Hypothesis::THexoticSizeMaps mySizeMaps;
65 double myFirstLayerSize;
68 std::vector<int> myFacesWithLayers;
69 std::vector<int> myImprintedFaces;
70 } HexoticHypothesisData;
73 * \brief Class for creation of MG-Hexa hypotheses
75 class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
80 HexoticPluginGUI_HypothesisCreator( const QString& );
81 virtual ~HexoticPluginGUI_HypothesisCreator();
83 virtual bool checkParams(QString&) const;
84 virtual QString helpPage() const;
87 virtual QFrame* buildFrame ();
88 virtual void retrieveParams() const;
89 virtual QString storeParams () const;
91 virtual QString caption() const;
92 virtual QPixmap icon() const;
93 virtual QString type() const;
96 bool readParamsFromHypo( HexoticHypothesisData& ) const;
97 bool readParamsFromWidgets( HexoticHypothesisData& ) const;
98 bool readSizeMapsFromWidgets( HexoticHypothesisData& ) const;
99 void insertLocalSizeInWidget( std::string entry, std::string shapeName, double size, int row ) const;
100 bool storeParamsToHypo( const HexoticHypothesisData& ) const;
101 void resizeEvent(QResizeEvent *event);
102 void printData(HexoticHypothesisData&) const;
104 GEOM::GEOM_Object_var entryToObject( std::string entry) const;
108 // QWidget* myStdGroup;
110 HexoticPluginGUI_StdWidget* myStdWidget;
111 HexoticPluginGUI_AdvWidget* myAdvWidget;
112 mutable HexoticPlugin::string_array_var myOptions, myCustomOptions;
113 HexoticPluginGUI_SizeMapsWidget* mySmpWidget;
114 HexoticPluginGUI_ViscousLayersWidget* myVLWidget;
115 StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg;
118 std::vector< std::string > mySizeMapsToRemove;
119 QVariant myNotModifiedSize;
122 void onAddLocalSize();
123 void onRemoveLocalSize();
124 void onTabChanged(int);
129 class SizeMapsTableWidgetDelegate : public QItemDelegate
134 SizeMapsTableWidgetDelegate(QObject *parent = 0);
136 QWidget *createEditor(QWidget *parent,
137 const QStyleOptionViewItem &option,
138 const QModelIndex &index) const;
140 void setEditorData(QWidget *editor,
141 const QModelIndex &index) const;
143 void setModelData(QWidget *editor,
144 QAbstractItemModel *model,
145 const QModelIndex &index) const;
147 void updateEditorGeometry(QWidget *editor,
148 const QStyleOptionViewItem &option,
149 const QModelIndex &index) const;