1 // Copyright (C) 2009-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
20 // HEXABLOCKPlugin GUI: GUI for plugged-in mesher HEXABLOCKPlugin
21 // File : HEXABLOCKPluginGUI_HypothesisCreator.h
22 // Author : Lioka RAZAFINDRAZAKA (CEA)
23 // Module : HEXABLOCKPlugin
25 #ifndef HEXABLOCKPLUGINGUI_HypothesisCreator_HeaderFile
26 #define HEXABLOCKPLUGINGUI_HypothesisCreator_HeaderFile
29 #if defined HEXABLOCKPLUGINGUI_EXPORTS || defined HEXABLOCKPluginGUI_EXPORTS
30 #define HEXABLOCKPLUGINGUI_EXPORT __declspec( dllexport )
32 #define HEXABLOCKPLUGINGUI_EXPORT __declspec( dllimport )
35 #define HEXABLOCKPLUGINGUI_EXPORT
38 #include <SMESHGUI_Hypotheses.h>
39 // #include <SalomeApp_DoubleSpinBox.h>
41 #include <QItemDelegate>
44 #include CORBA_SERVER_HEADER(HEXABLOCKPlugin_Algorithm)
51 class QStandardItemModel;
56 class LightApp_SelectionMgr;
58 typedef std::vector<double> HEXABLOCKEnforcedVertex;
59 typedef std::vector<HEXABLOCKEnforcedVertex> TEnforcedVertexValues;
63 bool myToMeshHoles,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint;
64 int myMaximumMemory,myInitialMemory,myOptimizationLevel;
65 QString myName,myWorkingDir,myTextOption;
67 TEnforcedVertexValues myEnforcedVertices;
68 } HEXABLOCKHypothesisData;
71 \brief Class for creation of HEXABLOCK2D and HEXABLOCK3D hypotheses
73 class HEXABLOCKPLUGINGUI_EXPORT HEXABLOCKPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
78 HEXABLOCKPluginGUI_HypothesisCreator( const QString& );
79 virtual ~HEXABLOCKPluginGUI_HypothesisCreator();
81 virtual bool checkParams(QString& msg) const;
82 virtual QString helpPage() const;
85 virtual QFrame* buildFrame ();
86 virtual void retrieveParams() const;
87 virtual QString storeParams () const;
89 virtual QString caption() const;
90 virtual QPixmap icon() const;
91 virtual QString type() const;
94 void onDirBtnClicked();
96 void onVertexBtnClicked();
97 void onRemoveVertexBtnClicked();
98 bool checkVertexIsDefined();
101 void vertexDefined(bool);
104 bool readParamsFromHypo( HEXABLOCKHypothesisData& ) const;
105 bool readParamsFromWidgets( HEXABLOCKHypothesisData& ) const;
106 bool storeParamsToHypo( const HEXABLOCKHypothesisData& ) const;
107 bool smpVertexExists(double, double, double) const;
112 QCheckBox* myToMeshHolesCheck;
113 QComboBox* myOptimizationLevelCombo;
116 QCheckBox* myMaximumMemoryCheck;
117 QSpinBox* myMaximumMemorySpin;
118 QCheckBox* myInitialMemoryCheck;
119 QSpinBox* myInitialMemorySpin;
120 QLineEdit* myWorkingDir;
121 QCheckBox* myKeepFiles;
122 QSpinBox* myVerboseLevelSpin;
123 QCheckBox* myToCreateNewNodesCheck;
124 QCheckBox* myRemoveInitialCentralPointCheck;
125 QCheckBox* myBoundaryRecoveryCheck;
126 QCheckBox* myFEMCorrectionCheck;
127 QLineEdit* myTextOption;
130 QStandardItemModel* mySmpModel;
131 QTableView* myEnforcedTableView;
135 QLineEdit* mySizeValue;
136 QPushButton* addVertexButton;
137 QPushButton* removeVertexButton;
139 LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
140 // SVTK_Selector* mySelector;
143 class DoubleLineEditDelegate : public QItemDelegate
148 DoubleLineEditDelegate(QObject *parent = 0);
150 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
151 const QModelIndex &index) const;
153 void setEditorData(QWidget *editor, const QModelIndex &index) const;
154 void setModelData(QWidget *editor, QAbstractItemModel *model,
155 const QModelIndex &index) const;
157 void updateEditorGeometry(QWidget *editor,
158 const QStyleOptionViewItem &option, const QModelIndex &index) const;