Salome HOME
Migrate on CMake and Qt 5
[plugins/gmshplugin.git] / src / GUI / GMSHPluginGUI_HypothesisCreator.cxx
1 // Copyright (C) 2012-2015  ALNEOS
2 // Copyright (C) 2016  EDF R&D
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
8 //
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.alneos.com/ or email : contact@alneos.fr
19 //
20 #include "GMSHPluginGUI_HypothesisCreator.h"
21
22 #include <SMESHGUI_Utils.h>
23 #include <SMESHGUI_HypothesesUtils.h>
24 #include <SMESHGUI_SpinBox.h>
25 #include <GeomSelectionTools.h>
26
27 #include CORBA_SERVER_HEADER(GMSHPlugin_Algorithm)
28
29 #include <SUIT_Session.h>
30 #include <SUIT_ResourceMgr.h>
31
32 #include <SalomeApp_Tools.h>
33 #include <LightApp_SelectionMgr.h>
34 #include <SALOME_ListIO.hxx>
35
36 #include <QComboBox>
37 #include <QLabel>
38 #include <QGroupBox>
39 #include <QFrame>
40 #include <QLayout>
41 #include <QLineEdit>
42 #include <QCheckBox>
43 #include <QPixmap>
44 #include <QTableWidget>
45 #include <QHeaderView>
46 #include <QPushButton>
47
48 enum Algo2D
49   {
50    automatic,
51    meshadapt,
52    delaunay,
53    frontal,
54    delaunayforquad
55   };
56
57 enum Algo3D
58   {
59    frontal3,
60    frontaldelaunay,
61    fontalhex,
62    mmg3d,
63    rtree
64   };
65
66 enum Recomb2DAlgo
67   {
68    standard,
69    blossom
70   };
71
72 enum SubdivAlgo
73   {
74    none,
75    allquads,
76    allhexas
77   };
78
79 enum RemeshAlgo
80   {
81    nosplit,
82    automaticR,
83    automaticmetis
84   };
85
86 enum RemeshPara
87   {
88    harmonic,
89    conformal,
90    rbfharmonic
91   };
92
93
94 GMSHPluginGUI_HypothesisCreator::GMSHPluginGUI_HypothesisCreator( const QString& theHypType )
95   : SMESHGUI_GenericHypothesisCreator( theHypType )
96 {
97   myGeomSelectionTools = NULL;
98   myCompoundSet.clear();
99   myIs2D = ( theHypType.endsWith("2D"));
100 }
101
102 GMSHPluginGUI_HypothesisCreator::~GMSHPluginGUI_HypothesisCreator()
103 {
104 }
105
106 bool GMSHPluginGUI_HypothesisCreator::checkParams(QString& msg) const
107 {
108   GmshHypothesisData data_old, data_new;
109   readParamsFromHypo( data_old );
110   readParamsFromWidgets( data_new );
111   bool res = storeParamsToHypo( data_new );
112   storeParamsToHypo( data_old );
113   return res;
114 }
115
116 QFrame* GMSHPluginGUI_HypothesisCreator::buildFrame()
117 {
118   QFrame* fr = new QFrame( 0 );
119   fr->setObjectName( "myframe" );
120   QVBoxLayout* lay = new QVBoxLayout( fr );
121   lay->setMargin( 5 );
122   lay->setSpacing( 0 );
123
124   QTabWidget* tab = new QTabWidget( fr );
125   tab->setTabShape( QTabWidget::Rounded );
126   tab->setTabPosition( QTabWidget::North );
127   lay->addWidget( tab );
128   QWidget* GroupC1 = new QWidget();
129   tab->insertTab( 0, GroupC1, tr( "SMESH_ARGUMENTS" ) );
130   
131   QGridLayout* aGroupLayout = new QGridLayout( GroupC1 );
132   aGroupLayout->setSpacing( 6 );
133   aGroupLayout->setMargin( 11 );
134   
135   int row = 0;
136   myName = 0;
137   if( isCreation() )
138   {
139     aGroupLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0 );
140     myName = new QLineEdit( GroupC1 );
141     myName->setMinimumWidth(160);
142     aGroupLayout->addWidget( myName, row, 1 );
143     row++;
144   }
145
146   aGroupLayout->addWidget( new QLabel( tr( "GMSH_2D_ALGO" ), GroupC1 ), row, 0 );
147   my2DAlgo = new QComboBox( GroupC1 );
148   QStringList types2DAlgo;
149   types2DAlgo << tr( "GMSH_AUTOMATIC" ) << tr( "GMSH_MESH_ADAPT" )   << tr( "GMSH_DELAUNAY" ) <<
150                  tr( "GMSH_FRONTAL" )       << tr( "GMSH_DELAUNAY_FOR_QUAD" );
151   my2DAlgo->addItems( types2DAlgo );
152   aGroupLayout->addWidget( my2DAlgo, row, 1 );
153   row++;
154   
155   my3DAlgo = 0;
156   if ( !myIs2D )
157   {
158     aGroupLayout->addWidget( new QLabel( tr( "GMSH_3D_ALGO" ), GroupC1 ), row, 0 );
159     my3DAlgo = new QComboBox( GroupC1 );
160     QStringList types3DAlgo;
161     types3DAlgo << tr( "GMSH_FRONTAL_DELAUNAY" ) << tr( "GMSH_FRONTAL_HEX" )   << tr( "GMSH_MMG3D" ) <<
162                    tr( "GMSH_R_TREE" );
163     my3DAlgo->addItems( types3DAlgo );
164     aGroupLayout->addWidget( my3DAlgo, row, 1 );
165     row++;
166   }
167   
168   aGroupLayout->addWidget( new QLabel( tr( "GMSH_2D_RECOMB_ALGO" ), GroupC1 ), row, 0 );
169   myRecomb2DAlgo = new QComboBox( GroupC1 );
170   QStringList typesRecomb2DAlgo;
171   typesRecomb2DAlgo << tr( "GMSH_STANDARD" ) << tr( "GMSH_BLOSSOM" );
172   myRecomb2DAlgo->addItems( typesRecomb2DAlgo );
173   aGroupLayout->addWidget( myRecomb2DAlgo, row, 1 );
174   row++;
175   
176   myRecombineAll = new QCheckBox( tr( "GMSH_RECOMBINE_ALL" ), GroupC1 );
177   aGroupLayout->addWidget( myRecombineAll, row, 0 );
178   row++;
179   
180   aGroupLayout->addWidget( new QLabel( tr( "GMSH_SUBDIV_ALGO" ), GroupC1 ), row, 0 );
181   mySubdivAlgo = new QComboBox( GroupC1 );
182   QStringList typesSubdivAlgo;
183   typesSubdivAlgo << tr( "GMSH_NONE" ) << tr( "GMSH_ALL_QUADS" )   << tr( "GMSH_ALL_HEXAS" );
184   mySubdivAlgo->addItems( typesSubdivAlgo );
185   aGroupLayout->addWidget( mySubdivAlgo, row, 1 );
186   row++;
187   
188   aGroupLayout->addWidget( new QLabel( tr( "GMSH_REMESH_ALGO" ), GroupC1 ), row, 0 );
189   myRemeshAlgo = new QComboBox( GroupC1 );
190   QStringList typesRemeshAlgo;
191   typesRemeshAlgo << tr( "GMSH_NO_SPLIT" ) << tr( "GMSH_AUTO" )   << tr( "GMSH_AUTO_ONLY_WITH_METIS" );
192   myRemeshAlgo->addItems( typesRemeshAlgo );
193   aGroupLayout->addWidget( myRemeshAlgo, row, 1 );
194   row++;
195   
196   aGroupLayout->addWidget( new QLabel( tr( "GMSH_REMESH_PARA" ), GroupC1 ), row, 0 );
197   myRemeshPara = new QComboBox( GroupC1 );
198   QStringList typesRemeshPara;
199   typesRemeshPara << tr( "GMSH_HARMONIC" ) << tr( "GMSH_CONFORMAL" )   << tr( "GMSH_RBF_HARMONIC" );
200   myRemeshPara->addItems( typesRemeshPara );
201   aGroupLayout->addWidget( myRemeshPara, row, 1 );
202   row++;
203   
204   aGroupLayout->addWidget( new QLabel( tr( "GMSH_SMOOTHING_STEPS" ), GroupC1 ), row, 0 );
205   mySmouthSteps = new SMESHGUI_SpinBox( GroupC1 );
206   mySmouthSteps->RangeStepAndValidator( 1, 1000, 1, "length_precision" );
207   aGroupLayout->addWidget( mySmouthSteps, row, 1 );
208   row++;
209
210   aGroupLayout->addWidget( new QLabel( tr( "GMSH_SIZE_FACTOR" ), GroupC1 ), row, 0 );
211   mySizeFactor = new SMESHGUI_SpinBox( GroupC1 );
212   mySizeFactor->RangeStepAndValidator( 1e-06, 1e+06, 0.1, "length_precision" );
213   aGroupLayout->addWidget( mySizeFactor, row, 1 );
214   row++;
215   
216   aGroupLayout->addWidget( new QLabel( tr( "GMSH_MIN_SIZE" ), GroupC1 ), row, 0 );
217   myMinSize = new SMESHGUI_SpinBox( GroupC1 );
218   myMinSize->RangeStepAndValidator( 0.0, 1e+22, 1., "length_precision" );
219   aGroupLayout->addWidget( myMinSize, row, 1 );
220   row++;
221   
222   aGroupLayout->addWidget( new QLabel( tr( "GMSH_MAX_SIZE" ), GroupC1 ), row, 0 );
223   myMaxSize = new SMESHGUI_SpinBox( GroupC1 );
224   myMaxSize->RangeStepAndValidator( 0.0, 1e+22, 1e+21, "length_precision" );
225   aGroupLayout->addWidget( myMaxSize, row, 1 );
226   row++;
227   
228   mySecondOrder = new QCheckBox( tr( "GMSH_SECOND_ORDER" ), GroupC1 );
229   aGroupLayout->addWidget( mySecondOrder, row, 0 );
230   
231   myUseIncomplElem = new QCheckBox( tr( "GMSH_USE_INCOMPLETE_ELEMENT" ), GroupC1 );
232   aGroupLayout->addWidget( myUseIncomplElem, row, 1 );
233   row++;
234   
235   connect( mySecondOrder, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
236   
237   // Compounds
238   QWidget* compoundGroup = new QWidget();
239   tab->insertTab(1, compoundGroup, tr("GMSH_COMPOUND"));
240   
241   myCompoundTable = new QTableWidget(0, 2, compoundGroup);
242   QGridLayout* compoundLayout = new QGridLayout(compoundGroup);
243   compoundLayout->addWidget(myCompoundTable, 1, 0, 8, 1);
244   
245   QStringList compoundHeaders;
246   compoundHeaders << tr( "GMSH_COMPOUND_ENTRY_COLUMN" ) << tr( "GMSH_COMPOUND_NAME_COLUMN" );
247   myCompoundTable->setHorizontalHeaderLabels(compoundHeaders);
248   myCompoundTable->horizontalHeader()->hideSection(0);
249 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
250   myCompoundTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
251 #else
252   myCompoundTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
253 #endif
254   myCompoundTable->resizeColumnToContents(1);
255   myCompoundTable->setAlternatingRowColors(true);
256   myCompoundTable->verticalHeader()->hide();
257   
258   QPushButton* addCompoundButton = new QPushButton(tr("GMSH_COMPOUND_ADD"), compoundGroup);
259   compoundLayout->addWidget(addCompoundButton, 1, 1, 1, 1);
260   QFrame *line2 = new QFrame(compoundGroup);
261   
262   line2->setFrameShape(QFrame::HLine);
263   line2->setFrameShadow(QFrame::Sunken);
264   compoundLayout->addWidget(line2, 2, 1, 1, 1);
265   
266   QPushButton* removeButton = new QPushButton(tr("GMSH_COMPOUND_REMOVE"), compoundGroup);
267   compoundLayout->addWidget(removeButton, 3, 1, 1, 1);
268
269   connect( addCompoundButton, SIGNAL(clicked()), this, SLOT(onAddCompound()));
270   connect( removeButton, SIGNAL(clicked()), this, SLOT(onRemoveCompound()));
271   
272   return fr;
273 }
274
275 void GMSHPluginGUI_HypothesisCreator::updateWidgets()
276 {
277   myUseIncomplElem->setEnabled(mySecondOrder->isChecked());
278 }
279
280 void GMSHPluginGUI_HypothesisCreator::onAddCompound()
281 {
282   GMSHPlugin::GMSHPlugin_Hypothesis_var h = GMSHPlugin::GMSHPlugin_Hypothesis::_narrow(initParamsHypothesis());
283   GeomSelectionTools* geomSelectionTools = getGeomSelectionTools();
284   LightApp_SelectionMgr* mySel = geomSelectionTools->selectionMgr();
285   SALOME_ListIO ListSelectedObjects;
286   mySel->selectedObjects(ListSelectedObjects, NULL, false );
287   SALOME_ListIteratorOfListIO Object_It(ListSelectedObjects);
288   for (Object_It ; Object_It.More() ; Object_It.Next())
289   {
290     Handle(SALOME_InteractiveObject) anObject = Object_It.Value();
291     std::string entry, shapeName;
292     entry = geomSelectionTools->getEntryOfObject(anObject);
293     shapeName = anObject->getName();
294     TopAbs_ShapeEnum shapeType;
295     shapeType = geomSelectionTools->entryToShapeType(entry);
296     if ((shapeType == TopAbs_SHAPE) || (shapeType != TopAbs_EDGE && shapeType != TopAbs_FACE))
297       continue;
298     myCompoundTable->setFocus();
299     QString shapeEntry;
300     shapeEntry = QString::fromStdString(entry);
301     if (myCompoundSet.contains(shapeEntry))
302       continue;
303     int row = myCompoundTable->rowCount() ;
304     myCompoundTable->setRowCount(row+1);
305     myCompoundTable->setItem(row, 0, new QTableWidgetItem(shapeEntry));
306     myCompoundTable->item(row, 0 )->setFlags(0);
307     myCompoundTable->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(shapeName)));
308     myCompoundTable->item(row, 1 )->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
309     myCompoundTable->resizeColumnToContents(1);
310     myCompoundTable->clearSelection();
311     myCompoundTable->scrollToItem( myCompoundTable->item( row, 1 ) );
312     myCompoundSet.insert(shapeEntry);
313     myCompoundToRemove.remove(shapeEntry);
314   }
315 }
316
317 void GMSHPluginGUI_HypothesisCreator::onRemoveCompound()
318 {
319   QList<int> selectedRows;
320   QList<QTableWidgetItem*> selected = myCompoundTable->selectedItems();
321   QTableWidgetItem* item;
322   int row;
323   foreach(item, selected)
324   {
325     row = item->row();
326     if (!selectedRows.contains(row))
327       selectedRows.append( row );
328   }
329   qSort( selectedRows );
330   QListIterator<int> it( selectedRows );
331   it.toBack();
332   while (it.hasPrevious())
333   {
334     row = it.previous();
335     QString entry = myCompoundTable->item(row,0)->text();
336     if (myCompoundSet.contains(entry))
337     {
338       myCompoundSet.remove(entry);
339       myCompoundToRemove.insert(entry);
340     }
341     myCompoundTable->removeRow(row );
342   }
343   myCompoundTable->resizeColumnToContents(1);
344 }
345
346 void GMSHPluginGUI_HypothesisCreator::retrieveParams() const
347 {
348   GmshHypothesisData data;
349   readParamsFromHypo( data );
350   
351   if( myName )
352     myName->setText( data.myName );
353   my2DAlgo->setCurrentIndex( data.my2DAlgo );
354   if ( !myIs2D )
355     my3DAlgo->setCurrentIndex( data.my3DAlgo );
356   myRecomb2DAlgo->setCurrentIndex( data.myRecomb2DAlgo );
357   if ( myRecombineAll )
358     myRecombineAll->setChecked( data.myRecombineAll );
359   if ( mySubdivAlgo )
360   mySubdivAlgo->setCurrentIndex( data.mySubdivAlgo );
361   myRemeshAlgo->setCurrentIndex( data.myRemeshAlgo);
362   myRemeshPara->setCurrentIndex( data.myRemeshPara);
363   if(data.mySmouthStepsVar.isEmpty())
364     mySmouthSteps->setValue( data.mySmouthSteps );
365   else
366     mySmouthSteps->setText( data.mySmouthStepsVar );
367   if(data.mySizeFactorVar.isEmpty())
368     mySizeFactor->setValue( data.mySizeFactor );
369   else
370     mySizeFactor->setText( data.mySizeFactorVar );
371   if(data.myMaxSizeVar.isEmpty())
372     myMaxSize->setValue( data.myMaxSize );
373   else
374     myMaxSize->setText( data.myMaxSizeVar );
375   if(data.myMinSizeVar.isEmpty())
376     myMinSize->setValue( data.myMinSize );
377   else
378     myMinSize->setText( data.myMinSizeVar );
379   if ( mySecondOrder )
380     mySecondOrder->setChecked( data.mySecondOrder );
381   if ( myUseIncomplElem )
382     myUseIncomplElem->setChecked( data.myUseIncomplElem );
383   
384   GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;
385   that->updateWidgets();
386   
387   GeomSelectionTools* geomSelectionTools = that->getGeomSelectionTools();
388   for (QSet<QString>::const_iterator i = myCompoundSet.begin(); i != myCompoundSet.end(); ++i)
389   {
390     const QString entry = *i;
391     std::string shapeName = geomSelectionTools->getNameFromEntry(entry.toStdString());
392     int row = myCompoundTable->rowCount();
393     myCompoundTable->setRowCount(row+1);
394     myCompoundTable->setItem(row, 0, new QTableWidgetItem(entry));
395     myCompoundTable->item(row, 0)->setFlags(0);
396     myCompoundTable->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(shapeName)));
397     myCompoundTable->item(row, 1)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
398   }
399   myCompoundTable->resizeColumnToContents(1);
400 }
401
402 QString GMSHPluginGUI_HypothesisCreator::storeParams() const
403 {
404   GmshHypothesisData data;
405   readParamsFromWidgets( data );
406   storeParamsToHypo( data );
407   
408   QString valStr = tr("GMSH_MAX_SIZE") + " = " + QString::number( data.myMaxSize ) + "; ";
409   valStr += tr("GMSH_MIN_SIZE") + " = " + QString::number( data.myMinSize ) + "; ";
410   if ( data.mySecondOrder )
411     valStr +=  tr("GMSH_SECOND_ORDER") + "; ";
412   
413   return valStr;
414 }
415
416 bool GMSHPluginGUI_HypothesisCreator::readParamsFromHypo( GmshHypothesisData& h_data ) const
417 {
418   GMSHPlugin::GMSHPlugin_Hypothesis_var h =
419     GMSHPlugin::GMSHPlugin_Hypothesis::_narrow( initParamsHypothesis() );
420
421   HypothesisData* data = SMESH::GetHypothesisData( hypType() );
422   h_data.myName = isCreation() && data ? data->Label : "";
423   
424   h_data.my2DAlgo = (int) h->Get2DAlgo();
425   if ( !myIs2D )
426     h_data.my3DAlgo = (int) h->Get3DAlgo();
427   h_data.myRecomb2DAlgo = (int) h->GetRecomb2DAlgo();
428   h_data.myRecombineAll = h->GetRecombineAll();
429   h_data.mySubdivAlgo = (int) h->GetSubdivAlgo();
430   h_data.myRemeshAlgo = (int) h->GetRemeshAlgo();
431   h_data.myRemeshPara = (int) h->GetRemeshPara();
432   h_data.mySmouthSteps = h->GetSmouthSteps();
433   h_data.mySizeFactor = h->GetSizeFactor();
434   h_data.myMinSize = h->GetMinSize();
435   h_data.myMaxSize = h->GetMaxSize();
436   h_data.mySmouthStepsVar = getVariableName("SmouthSteps");
437   h_data.mySizeFactorVar = getVariableName("SizeFactor");
438   h_data.myMinSizeVar = getVariableName("SetMinSize");
439   h_data.myMaxSizeVar = getVariableName("SetMaxSize");
440   h_data.mySecondOrder = h->GetSecondOrder();
441   h_data.myUseIncomplElem = h->GetUseIncomplElem();
442   
443   GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;
444   GMSHPlugin::string_array_var myEntries = h->GetCompoundOnEntries();
445   for ( int i=0 ; i<myEntries->length() ; i++ )
446     {
447       QString entry = myEntries[i].in();
448       that->myCompoundSet.insert(entry);
449     }
450   
451   return true;
452 }
453
454 bool GMSHPluginGUI_HypothesisCreator::storeParamsToHypo( const GmshHypothesisData& h_data ) const
455 {
456   GMSHPlugin::GMSHPlugin_Hypothesis_var h =
457     GMSHPlugin::GMSHPlugin_Hypothesis::_narrow( hypothesis() );
458
459   bool ok = true;
460   try
461   {
462     if( isCreation() )
463       SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
464
465     h->Set2DAlgo( h_data.my2DAlgo );
466     if ( !myIs2D )
467       h->Set3DAlgo( h_data.my3DAlgo );
468     h->SetRecomb2DAlgo( h_data.myRecomb2DAlgo );
469     h->SetRecombineAll( h_data.myRecombineAll );
470     h->SetSubdivAlgo( h_data.mySubdivAlgo );
471     h->SetRemeshAlgo( h_data.myRemeshAlgo );
472     h->SetRemeshPara( h_data.myRemeshPara );
473     h->SetSmouthSteps( h_data.mySmouthSteps );
474     h->SetSizeFactor( h_data.mySizeFactor );
475     h->SetMinSize( h_data.myMinSize );
476     h->SetMaxSize( h_data.myMaxSize );
477     h->SetVarParameter( h_data.mySmouthStepsVar.toLatin1().constData(), "SmouthSteps");
478     h->SetVarParameter( h_data.mySizeFactorVar.toLatin1().constData(), "SizeFactor");
479     h->SetVarParameter( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize");
480     h->SetVarParameter( h_data.myMaxSizeVar.toLatin1().constData(), "SetMaxSize");
481     h->SetSecondOrder( h_data.mySecondOrder );
482     h->SetUseIncomplElem( h_data.myUseIncomplElem );
483     h->SetIs2d( myIs2D );
484     
485     for (QSet<QString>::const_iterator i = myCompoundSet.begin(); i != myCompoundSet.end(); ++i)
486     {
487       const QString entry = *i;
488       h->SetCompoundOnEntry(entry.toLatin1().constData());
489     }
490     for (QSet<QString>::const_iterator i = myCompoundToRemove.begin(); i != myCompoundToRemove.end(); ++i)
491     {
492       const QString entry = *i;
493       h->UnsetCompoundOnEntry(entry.toLatin1().constData());
494     }
495   }
496   catch(const SALOME::SALOME_Exception& ex)
497   {
498     SalomeApp_Tools::QtCatchCorbaException(ex);
499     ok = false;
500   }
501   return ok;
502 }
503
504 bool GMSHPluginGUI_HypothesisCreator::readParamsFromWidgets( GmshHypothesisData& h_data ) const
505 {
506   h_data.myName           = myName ? myName->text() : "";
507   h_data.my2DAlgo         = my2DAlgo->currentIndex();
508   if (my3DAlgo)
509     h_data.my3DAlgo       = my3DAlgo->currentIndex();
510   h_data.myRecomb2DAlgo   = myRecomb2DAlgo->currentIndex();
511   h_data.myRecombineAll   = myRecombineAll->isChecked();
512   h_data.mySubdivAlgo     = mySubdivAlgo->currentIndex();
513   h_data.myRemeshAlgo     = myRemeshAlgo->currentIndex();
514   h_data.myRemeshPara     = myRemeshPara->currentIndex();
515   h_data.mySmouthSteps    = mySmouthSteps->value();
516   h_data.mySizeFactor     = mySizeFactor->value();
517   h_data.myMinSize        = myMinSize->value();
518   h_data.myMaxSize        = myMaxSize->value();
519   h_data.mySmouthStepsVar = mySmouthSteps->text();
520   h_data.mySizeFactorVar  = mySizeFactor->text();
521   h_data.myMinSizeVar     = myMinSize->text();
522   h_data.myMaxSizeVar     = myMaxSize->text();
523   h_data.mySecondOrder    = mySecondOrder->isChecked();
524   h_data.myUseIncomplElem = myUseIncomplElem->isChecked();
525   
526   // ne semble pas utile dans la mesure ou myCompoundSet n'a pas besoin d'etre modifier
527   /*
528   GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;
529   int nbRows = myCompoundTable->rowCount();
530   for(int row=0 ; row < nbRows ; row++)
531   {
532     QString entry = myLocalSizeTable->item(row, 1)->text();
533     that->myCompoundSet.insert(entry);
534   }
535   */
536   return true;
537 }
538
539 // on ne modifie rien à partir de là
540
541 GeomSelectionTools* GMSHPluginGUI_HypothesisCreator::getGeomSelectionTools()
542 {
543   _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
544   if (myGeomSelectionTools == NULL || myGeomSelectionTools->getMyStudy() != aStudy) {
545     delete myGeomSelectionTools;
546     myGeomSelectionTools = new GeomSelectionTools(aStudy);
547   }
548   return myGeomSelectionTools;
549 }
550
551 QString GMSHPluginGUI_HypothesisCreator::caption() const
552 {
553   return tr( QString( "GMSH_%1_TITLE" ).arg(myIs2D?QString("2D"):QString("3D")).toLatin1().data() );
554 }
555
556 QPixmap GMSHPluginGUI_HypothesisCreator::icon() const
557 {
558   QString hypIconName = tr( QString("ICON_DLG_GMSH_PARAMETERS%1").arg(myIs2D?QString("_2D"):QString("")).toLatin1().data() );
559   return SUIT_Session::session()->resourceMgr()->loadPixmap( "GMSHPlugin", hypIconName );
560 }
561
562 QString GMSHPluginGUI_HypothesisCreator::type() const
563 {
564   return tr( QString( "GMSH_%1_HYPOTHESIS" ).arg(myIs2D?QString("2D"):QString("3D")).toLatin1().data() );
565 }
566
567 QString GMSHPluginGUI_HypothesisCreator::helpPage() const
568 {
569   return "gmsh_2d_3d_hypo_page.html";
570 }