1 // Copyright (C) 2007-2014 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;
47 int myHexesMinLevel, myHexesMaxLevel;
48 double myMinSize, myMaxSize;
49 bool myHexoticInvalidElements;
50 bool myHexoticIgnoreRidges;
51 double myHexoticSharpAngleThreshold;
53 QString myHexoticWorkingDir;
54 int myHexoticVerbosity;
55 int myHexoticMaxMemory;
57 HexoticPlugin_Hypothesis::THexoticSizeMaps mySizeMaps;
58 } HexoticHypothesisData;
61 * \brief Class for creation of Hexotic hypotheses
63 class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
68 HexoticPluginGUI_HypothesisCreator( const QString& );
69 virtual ~HexoticPluginGUI_HypothesisCreator();
71 virtual bool checkParams(QString&) const;
72 virtual QString helpPage() const;
75 virtual QFrame* buildFrame ();
76 virtual void retrieveParams() const;
77 virtual QString storeParams () const;
79 virtual QString caption() const;
80 virtual QPixmap icon() const;
81 virtual QString type() const;
84 bool readParamsFromHypo( HexoticHypothesisData& ) const;
85 bool readParamsFromWidgets( HexoticHypothesisData& ) const;
86 bool readSizeMapsFromWidgets( HexoticHypothesisData& ) const;
87 void insertLocalSizeInWidget( std::string entry, std::string shapeName, double size, int row ) const;
88 bool storeParamsToHypo( const HexoticHypothesisData& ) const;
89 void resizeEvent(QResizeEvent *event);
90 void printData(HexoticHypothesisData&) const;
92 GEOM::GEOM_Object_var entryToObject( std::string entry) const;
96 // QWidget* myStdGroup;
98 HexoticPluginGUI_StdWidget* myStdWidget;
99 HexoticPluginGUI_SizeMapsWidget* mySmpWidget;
100 StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg;
103 std::vector< std::string > mySizeMapsToRemove;
104 QVariant myNotModifiedSize;
107 void onAddLocalSize();
108 void onRemoveLocalSize();
112 class SizeMapsTableWidgetDelegate : public QItemDelegate
117 SizeMapsTableWidgetDelegate(QObject *parent = 0);
119 QWidget *createEditor(QWidget *parent,
120 const QStyleOptionViewItem &option,
121 const QModelIndex &index) const;
123 void setEditorData(QWidget *editor,
124 const QModelIndex &index) const;
126 void setModelData(QWidget *editor,
127 QAbstractItemModel *model,
128 const QModelIndex &index) const;
130 void updateEditorGeometry(QWidget *editor,
131 const QStyleOptionViewItem &option,
132 const QModelIndex &index) const;