1 // Copyright (C) 2004-2011 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.
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 // GHS3DPlugin GUI: GUI for plugged-in mesher GHS3DPlugin
21 // File : GHS3DPluginGUI_HypothesisCreator.h
22 // Author : Michael Zorin
23 // Module : GHS3DPlugin
25 #ifndef GHS3DPLUGINGUI_HypothesisCreator_HeaderFile
26 #define GHS3DPLUGINGUI_HypothesisCreator_HeaderFile
29 #if defined GHS3DPluginGUI_EXPORTS
30 #define GHS3DPLUGINGUI_EXPORT __declspec( dllexport )
32 #define GHS3DPLUGINGUI_EXPORT __declspec( dllimport )
35 #define GHS3DPLUGINGUI_EXPORT
38 #include <SMESHGUI_Hypotheses.h>
39 // #include <SalomeApp_DoubleSpinBox.h>
41 #include <QItemDelegate>
45 #include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm)
52 class QStandardItemModel;
57 class LightApp_SelectionMgr;
62 std::string geomEntry;
63 std::vector<double> coords;
64 std::string groupName;
68 struct CompareEnfVertices
70 bool operator () (const TEnfVertex* e1, const TEnfVertex* e2) const {
72 if (e1->coords.size() && e2->coords.size())
73 return (e1->coords < e2->coords);
75 return (e1->geomEntry < e2->geomEntry);
81 // List of enforced vertices
82 typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
84 // typedef std::vector<GHS3DEnforcedVertex> TEnforcedVertexCoordsValues;
88 bool myToMeshHoles,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint;
89 int myMaximumMemory,myInitialMemory,myOptimizationLevel;
90 QString myName,myWorkingDir,myTextOption;
92 TEnfVertexList myEnforcedVertices;
93 } GHS3DHypothesisData;
96 \brief Class for creation of GHS3D2D and GHS3D3D hypotheses
98 class GHS3DPLUGINGUI_EXPORT GHS3DPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
103 GHS3DPluginGUI_HypothesisCreator( const QString& );
104 virtual ~GHS3DPluginGUI_HypothesisCreator();
106 virtual bool checkParams(QString& msg) const;
107 virtual QString helpPage() const;
110 virtual QFrame* buildFrame ();
111 virtual void retrieveParams() const;
112 virtual QString storeParams () const;
114 virtual QString caption() const;
115 virtual QPixmap icon() const;
116 virtual QString type() const;
119 void onDirBtnClicked();
120 void updateWidgets();
121 void onVertexBtnClicked();
122 void onRemoveVertexBtnClicked();
123 bool checkVertexIsDefined();
126 void vertexDefined(bool);
129 bool readParamsFromHypo( GHS3DHypothesisData& ) const;
130 bool readParamsFromWidgets( GHS3DHypothesisData& ) const;
131 bool storeParamsToHypo( const GHS3DHypothesisData& ) const;
132 bool smpVertexExists(double, double, double) const;
137 QCheckBox* myToMeshHolesCheck;
138 QComboBox* myOptimizationLevelCombo;
141 QCheckBox* myMaximumMemoryCheck;
142 QSpinBox* myMaximumMemorySpin;
143 QCheckBox* myInitialMemoryCheck;
144 QSpinBox* myInitialMemorySpin;
145 QLineEdit* myWorkingDir;
146 QCheckBox* myKeepFiles;
147 QSpinBox* myVerboseLevelSpin;
148 QCheckBox* myToCreateNewNodesCheck;
149 QCheckBox* myRemoveInitialCentralPointCheck;
150 QCheckBox* myBoundaryRecoveryCheck;
151 QCheckBox* myFEMCorrectionCheck;
152 QLineEdit* myTextOption;
155 QStandardItemModel* mySmpModel;
156 QTableView* myEnforcedTableView;
160 QLineEdit* mySizeValue;
161 QPushButton* addVertexButton;
162 QPushButton* removeVertexButton;
164 LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
165 // SVTK_Selector* mySelector;
168 class DoubleLineEditDelegate : public QItemDelegate
173 DoubleLineEditDelegate(QObject *parent = 0);
175 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
176 const QModelIndex &index) const;
178 void setEditorData(QWidget *editor, const QModelIndex &index) const;
179 void setModelData(QWidget *editor, QAbstractItemModel *model,
180 const QModelIndex &index) const;
182 void updateEditorGeometry(QWidget *editor,
183 const QStyleOptionViewItem &option, const QModelIndex &index) const;