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