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