1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
\r
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
\r
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
\r
6 // This library is free software; you can redistribute it and/or
\r
7 // modify it under the terms of the GNU Lesser General Public
\r
8 // License as published by the Free Software Foundation; either
\r
9 // version 2.1 of the License, or (at your option) any later version.
\r
11 // This library is distributed in the hope that it will be useful,
\r
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
14 // Lesser General Public License for more details.
\r
16 // You should have received a copy of the GNU Lesser General Public
\r
17 // License along with this library; if not, write to the Free Software
\r
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
\r
22 // SMESH SMESHGUI : GUI for the adaptation in the SMESH component
\r
23 // File : MG_ADAPTGUI.hxx
\r
25 #ifndef MG_ADAPTGUI_HXX
\r
26 #define MG_ADAPTGUI_HXX
\r
33 #include <QTreeWidget>
\r
34 #include<QItemDelegate>
\r
36 #include "LightApp_DataOwner.h"
\r
37 #include "SalomeApp_Application.h"
\r
38 #include <SALOMEconfig.h>
\r
39 #include <SALOME_ListIO.hxx>
\r
40 #include "SalomeApp_Module.h"
\r
41 #include "SalomeApp_Study.h"
\r
49 //~#include "MG_ADAPT.hxx"
\r
51 #include CORBA_SERVER_HEADER(MG_ADAPT)
\r
53 class SUIT_ViewWindow;
\r
56 class SUIT_ResourceMgr;
\r
60 class SALOMEDSClient_Study;
\r
61 class SALOMEDSClient_SObject;
\r
63 class SalomeApp_Study;
\r
64 class SalomeApp_Module;
\r
65 class LightApp_SelectionMgr;
\r
76 class QDoubleSpinBox;
\r
79 class QTreeWidgetItem;
\r
82 class QItemDelegate;
\r
86 #include <SALOMEconfig.h>
\r
88 class SVTK_ViewWindow;
\r
89 class SVTK_Selector;
\r
90 class SMESHGUI_MgAdaptDlg;
\r
91 class SMESHGUI_MgAdaptArguments;
\r
92 class SMESHGUI_SpinBox;
\r
93 class MgAdaptAdvWidgetTreeWidget;
\r
94 class MgAdaptAdvWidget;
\r
100 std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage = true);
\r
101 QString lireNomMaillage(QString aFile, med_int& meshDim);
\r
102 QString lireNomMaillage2(med_idt medIdt,int meshId, med_int& meshDim);
\r
103 med_idt OuvrirFichier(QString aFile);
\r
104 std::string remove_extension(const std::string& filename);
\r
107 enum ADAPTATION_MODE{
\r
108 SURFACE, // surface adaption when meshDim == 2
\r
112 //=================================================================================
\r
113 // class : SMESHGUI_MgAdaptDlg
\r
115 //=================================================================================
\r
116 class SMESHGUI_MgAdaptDlg : public QDialog
\r
121 enum Mode { Arguments, AdvancedOptions};
\r
122 SMESHGUI_MgAdaptDlg( SalomeApp_Module*, SMESH::MG_ADAPT_ptr, QWidget* parent= 0,bool isCreation = true );
\r
123 ~SMESHGUI_MgAdaptDlg();
\r
127 bool checkParams(QString& msg) ;
\r
128 //~void setModel(MgAdapt*);
\r
129 SMESH::MG_ADAPT_ptr getModel() const;
\r
134 virtual bool PushOnApply();
\r
137 virtual void PushOnHelp();
\r
138 virtual void PushOnOK();
\r
142 SMESHGUI_MgAdaptArguments* myArgs;
\r
143 MgAdaptAdvWidget* myAdvOpt;
\r
144 bool readParamsFromHypo( ) const ;
\r
145 bool readParamsFromWidgets( ) ;
\r
146 bool storeParamsToHypo( const SMESH::MgAdaptHypothesisData & ) const;
\r
150 SalomeApp_Module* mySMESHGUI; /* Current SMESHGUI object */
\r
151 QTabWidget* myTabWidget;
\r
154 SMESH::MgAdaptHypothesisData* myData;
\r
155 SMESH::MG_ADAPT_ptr model;
\r
159 class SMESHGUI_MgAdaptArguments : public QWidget
\r
164 enum Mode { Mesh, Browser};
\r
165 enum SIZEMAP { Local, Background, Constant};
\r
166 SMESHGUI_MgAdaptArguments( QWidget* parent);
\r
167 ~SMESHGUI_MgAdaptArguments();
\r
168 void setMode( const Mode, const SIZEMAP );
\r
169 med_int getMeshDim() const;
\r
171 QString* myFileInDir;
\r
172 QString* myFileOutDir;
\r
173 QString* myFileSizeMapDir;
\r
174 QGroupBox* aMeshIn ;
\r
175 QRadioButton* aMedfile;
\r
176 QRadioButton* aBrowser ;
\r
177 QLineEdit* aBrowserObject;
\r
178 QPushButton* selectMedFilebutton ;
\r
179 QSpacerItem* hspacer;
\r
180 QLineEdit* selectMedFileLineEdit ;
\r
181 QButtonGroup* meshInGroup ;
\r
182 QGridLayout* meshIn ;
\r
184 QGroupBox* aMeshOut ;
\r
186 QLineEdit* meshNameLineEdit;
\r
187 QSpacerItem* secondHspacer;
\r
188 QCheckBox* medFileCheckBox;
\r
189 QPushButton* selectOutMedFilebutton;
\r
190 QLineEdit* selectOutMedFileLineEdit;
\r
191 QSpacerItem* thirdHspacer;
\r
192 QCheckBox* publishOut;
\r
193 QGridLayout* meshOut ;
\r
195 QGroupBox* sizeMapDefinition ;
\r
196 QRadioButton* localButton;
\r
197 QRadioButton* backgroundButton ;
\r
198 QRadioButton* constantButton ;
\r
199 QLabel* medFileBackground;
\r
200 QPushButton* selectMedFileBackgroundbutton;
\r
201 QLineEdit* selectMedFileBackgroundLineEdit;
\r
202 QLabel* valueLabel;
\r
203 QDoubleSpinBox* dvalue;
\r
204 QButtonGroup* sizeMapDefGroup ;
\r
205 QGridLayout* sizeMapDefGroupLayout;
\r
208 QGroupBox* sizeMapField;
\r
210 QComboBox* fieldNameCmb;
\r
211 QRadioButton* noTimeStep;
\r
212 QRadioButton* lastTimeStep ;
\r
213 QRadioButton* chosenTimeStep;
\r
214 QLabel* timeStepLabel;
\r
215 QSpinBox* timeStep;
\r
217 QSpinBox* rankSpinBox;
\r
218 QButtonGroup* timeStepGroup;
\r
219 QGridLayout* sizeMapFieldGroupLayout;
\r
222 void updateSelection();
\r
223 void toExportMED(const char *);
\r
224 void meshDimSignal(ADAPTATION_MODE aMode);
\r
230 void modeChanged( int);
\r
231 void sizeMapDefChanged(int);
\r
232 void timeStepGroupChanged(int timeStepType, bool disableOther = false, int vmax = 0);
\r
233 void onSelectMedFilebuttonClicked();
\r
235 void onMedFileCheckBox(int);
\r
236 void onPublishOut(int);
\r
237 void onSelectOutMedFilebutton();
\r
238 void onSelectMedFileBackgroundbutton();
\r
239 void onLocalSelected(QString);
\r
240 void onNoTimeStep(bool disableOther = false);
\r
241 void onLastTimeStep(bool disableOther = false);
\r
242 void onChosenTimeStep(bool disableOther = false, int vmax = 0);
\r
243 void visibleTimeStepRankLabel(bool visible);
\r
247 QString getMedFileName(bool avertir);
\r
248 LightApp_SelectionMgr* selMgr ;
\r
250 std::map<QString, int> myFieldList;
\r
254 OPTION_ID_COLUMN = 0,
\r
255 OPTION_TYPE_COLUMN,
\r
256 OPTION_NAME_COLUMN = 0,
\r
257 OPTION_VALUE_COLUMN,
\r
261 //////////////////////////////////////////
\r
262 // MgAdaptAdvWidget
\r
263 //////////////////////////////////////////
\r
264 class MgAdaptAdvWidget : public QWidget
\r
269 MgAdaptAdvWidget( QWidget* = 0, std::vector <std::string> * = nullptr, Qt::WindowFlags = 0 );
\r
270 ~MgAdaptAdvWidget();
\r
271 std::vector < std::string > * myOptions;
\r
272 QGridLayout *gridLayout_4;
\r
273 MgAdaptAdvWidgetTreeWidget *myOptionTable;
\r
274 QPushButton *addBtn;
\r
275 QSpacerItem *horizontalSpacer;
\r
276 QGroupBox *logGroupBox;
\r
277 QGridLayout *gridLayout_2;
\r
278 QGridLayout *gridLayout;
\r
279 QLabel *workingDirectoryLabel;
\r
280 QLineEdit *workingDirectoryLineEdit;
\r
281 QPushButton *workingDirectoryPushButton;
\r
282 QLabel *verboseLevelLabel;
\r
283 QSpinBox *verboseLevelSpin;
\r
284 QHBoxLayout *horizontalLayout;
\r
285 QCheckBox *logInFileCheck;
\r
286 QCheckBox *removeLogOnSuccessCheck;
\r
287 QCheckBox *keepWorkingFilesCheck;
\r
289 void AddOption( const char* name_value_type, bool isCustom = false );
\r
290 void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
\r
291 void setupWidget();
\r
294 void onAddOption();
\r
295 void itemChanged(QTreeWidgetItem * tblRow, int column);
\r
296 void onMeshDimChanged(ADAPTATION_MODE aMode);
\r
298 void _onWorkingDirectoryPushButton();
\r
300 void setOptionValue(QString& option, QString& value);
\r
301 std::map<QString, QTreeWidgetItem *> optionTreeWidgetItem;
\r
303 QTreeWidgetItem* getNewQTreeWidgetItem(QTreeWidget* table, const char* option, QString& name, bool isCustom);
\r
307 enum { EDITABLE_ROLE = Qt::UserRole + 1, PARAM_NAME,
\r
308 NAME_COL = 0, VALUE_COL
\r
311 class ItemDelegate: public QItemDelegate
\r
315 ItemDelegate(QObject* parent=0): QItemDelegate(parent) {}
\r
316 QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &index) const;
\r
319 class MgAdaptAdvWidgetTreeWidget : public QTreeWidget
\r
323 MgAdaptAdvWidgetTreeWidget( QWidget* );
\r
326 QModelIndex moveCursor( CursorAction, Qt::KeyboardModifiers );
\r
327 void keyPressEvent( QKeyEvent* );
\r
330 #endif // MG_ADAPTGUI_HXX
\r