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