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