1 // Copyright (C) 2012-2015 ALNEOS
2 // Copyright (C) 2016-2023 EDF
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.
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.
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
18 // See http://www.alneos.com/ or email : contact@alneos.fr
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #include "GMSHPluginGUI_HypothesisCreator.h"
23 #include <SMESHGUI_Utils.h>
24 #include <SMESHGUI_HypothesesUtils.h>
25 #include <SMESHGUI_SpinBox.h>
26 #include <GeomSelectionTools.h>
28 #include CORBA_SERVER_HEADER(GMSHPlugin_Algorithm)
30 #include <SUIT_Session.h>
31 #include <SUIT_ResourceMgr.h>
33 #include <SalomeApp_Tools.h>
34 #include <LightApp_SelectionMgr.h>
35 #include <SALOME_ListIO.hxx>
45 #include <QTableWidget>
46 #include <QHeaderView>
47 #include <QPushButton>
56 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
57 packingparallelograms,
73 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=8
122 GMSHPluginGUI_HypothesisCreator::GMSHPluginGUI_HypothesisCreator( const QString& theHypType )
123 : SMESHGUI_GenericHypothesisCreator( theHypType )
125 myGeomSelectionTools = NULL;
126 myCompoundSet.clear();
127 myIs2D = ( theHypType.endsWith("2D"));
128 myIs3D = (theHypType.endsWith("3D"));
131 GMSHPluginGUI_HypothesisCreator::~GMSHPluginGUI_HypothesisCreator()
135 bool GMSHPluginGUI_HypothesisCreator::checkParams(QString& msg) const
137 GmshHypothesisData data_old, data_new;
138 readParamsFromHypo( data_old );
139 readParamsFromWidgets( data_new );
140 bool res = storeParamsToHypo( data_new );
141 msg = data_new.myErrorMsg;
142 storeParamsToHypo( data_old );
146 QFrame* GMSHPluginGUI_HypothesisCreator::buildFrame()
148 QFrame* fr = new QFrame( 0 );
149 fr->setObjectName( "myframe" );
150 QVBoxLayout* lay = new QVBoxLayout( fr );
152 lay->setSpacing( 0 );
154 QTabWidget* tab = new QTabWidget( fr );
155 tab->setTabShape( QTabWidget::Rounded );
156 tab->setTabPosition( QTabWidget::North );
157 lay->addWidget( tab );
158 QWidget* GroupC1 = new QWidget();
159 tab->insertTab( 0, GroupC1, tr( "SMESH_ARGUMENTS" ) );
161 QGridLayout* aGroupLayout = new QGridLayout( GroupC1 );
162 aGroupLayout->setSpacing( 6 );
163 aGroupLayout->setMargin( 11 );
169 aGroupLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0 );
170 myName = new QLineEdit( GroupC1 );
171 myName->setMinimumWidth(160);
172 aGroupLayout->addWidget( myName, row, 1 );
179 aGroupLayout->addWidget(new QLabel(tr("GMSH_2D_ALGO"), GroupC1), row, 0);
180 my2DAlgo = new QComboBox(GroupC1);
181 QStringList types2DAlgo;
182 types2DAlgo << tr("GMSH_AUTOMATIC")
183 << tr("GMSH_MESH_ADAPT")
184 << tr("GMSH_DELAUNAY")
185 << tr("GMSH_FRONTAL")
186 << tr("GMSH_DELAUNAY_FOR_QUAD")
187 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
188 << tr("GMSH_PACKING_OF_PARALLELOGRAMS")
189 << tr("GMSH_QUASI_STRUCTURED_QUAD");
191 << tr("GMSH_PACKING_OF_PARALLELOGRAMS");
193 my2DAlgo->addItems(types2DAlgo);
194 aGroupLayout->addWidget(my2DAlgo, row, 1);
201 aGroupLayout->addWidget( new QLabel( tr( "GMSH_3D_ALGO" ), GroupC1 ), row, 0 );
202 my3DAlgo = new QComboBox( GroupC1 );
203 QStringList types3DAlgo;
204 types3DAlgo << tr( "GMSH_DELAUNAY3" ) << tr( "GMSH_FRONTAL_DELAUNAY" ) << tr( "GMSH_MMG3D" ) <<
205 tr( "GMSH_R_TREE" ) << tr( "GMSH_HXT" );
206 my3DAlgo->addItems( types3DAlgo );
207 aGroupLayout->addWidget( my3DAlgo, row, 1 );
214 aGroupLayout->addWidget(new QLabel(tr("GMSH_2D_RECOMB_ALGO"), GroupC1), row, 0);
215 myRecomb2DAlgo = new QComboBox(GroupC1);
216 QStringList typesRecomb2DAlgo;
217 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=8
218 typesRecomb2DAlgo << tr("GMSH_SIMPLE") << tr("GMSH_BLOSSOM") << tr("GMSH_SIMPLE_FULL_QUADS") << tr("GMSH_BLOSSOM_FULL_QUADS");
220 typesRecomb2DAlgo << tr("GMSH_STANDARD") << tr("GMSH_BLOSSOM");
222 myRecomb2DAlgo->addItems(typesRecomb2DAlgo);
223 aGroupLayout->addWidget(myRecomb2DAlgo, row, 1);
226 myRecombineAll = new QCheckBox( tr( "GMSH_RECOMBINE_ALL" ), GroupC1 );
227 aGroupLayout->addWidget( myRecombineAll, row, 0 );
232 aGroupLayout->addWidget(new QLabel(tr("GMSH_SUBDIV_ALGO"), GroupC1), row, 0);
233 mySubdivAlgo = new QComboBox(GroupC1);
234 QStringList typesSubdivAlgo;
235 typesSubdivAlgo << tr("GMSH_NONE") << tr("GMSH_ALL_QUADS") << tr("GMSH_ALL_HEXAS");
236 mySubdivAlgo->addItems(typesSubdivAlgo);
237 aGroupLayout->addWidget(mySubdivAlgo, row, 1);
244 aGroupLayout->addWidget(new QLabel(tr("GMSH_REMESH_ALGO"), GroupC1), row, 0);
245 myRemeshAlgo = new QComboBox(GroupC1);
246 QStringList typesRemeshAlgo;
247 typesRemeshAlgo << tr("GMSH_NO_SPLIT") << tr("GMSH_AUTO") << tr("GMSH_AUTO_ONLY_WITH_METIS");
248 myRemeshAlgo->addItems(typesRemeshAlgo);
249 aGroupLayout->addWidget(myRemeshAlgo, row, 1);
252 aGroupLayout->addWidget(new QLabel(tr("GMSH_REMESH_PARA"), GroupC1), row, 0);
253 myRemeshPara = new QComboBox(GroupC1);
254 QStringList typesRemeshPara;
255 typesRemeshPara << tr("GMSH_HARMONIC") << tr("GMSH_CONFORMAL") << tr("GMSH_RBF_HARMONIC");
256 myRemeshPara->addItems(typesRemeshPara);
257 aGroupLayout->addWidget(myRemeshPara, row, 1);
261 aGroupLayout->addWidget( new QLabel( tr( "GMSH_SMOOTHING_STEPS" ), GroupC1 ), row, 0 );
262 mySmouthSteps = new SMESHGUI_SpinBox( GroupC1 );
263 mySmouthSteps->RangeStepAndValidator( 1, 1000, 1, "length_precision" );
264 aGroupLayout->addWidget( mySmouthSteps, row, 1 );
267 aGroupLayout->addWidget( new QLabel( tr( "GMSH_SIZE_FACTOR" ), GroupC1 ), row, 0 );
268 mySizeFactor = new SMESHGUI_SpinBox( GroupC1 );
269 mySizeFactor->RangeStepAndValidator( 1e-06, 1e+06, 0.1, "length_precision" );
270 aGroupLayout->addWidget( mySizeFactor, row, 1 );
273 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
274 aGroupLayout->addWidget( new QLabel( tr( "GMSH_SIZE_FROM_CURVATURE" ), GroupC1 ), row, 0 );
275 myMeshCurvatureSize = new SMESHGUI_SpinBox( GroupC1 );
276 myMeshCurvatureSize->RangeStepAndValidator( 0.0, 1e+22, 1.0, "length_precision" );
277 aGroupLayout->addWidget( myMeshCurvatureSize, row, 1 );
281 aGroupLayout->addWidget( new QLabel( tr( "GMSH_MIN_SIZE" ), GroupC1 ), row, 0 );
282 myMinSize = new SMESHGUI_SpinBox( GroupC1 );
283 myMinSize->RangeStepAndValidator( 0.0, 1e+22, 1., "length_precision" );
284 aGroupLayout->addWidget( myMinSize, row, 1 );
287 aGroupLayout->addWidget( new QLabel( tr( "GMSH_MAX_SIZE" ), GroupC1 ), row, 0 );
288 myMaxSize = new SMESHGUI_SpinBox( GroupC1 );
289 myMaxSize->RangeStepAndValidator( 0.0, 1e+22, 1e+21, "length_precision" );
290 aGroupLayout->addWidget( myMaxSize, row, 1 );
293 mySecondOrder = new QCheckBox( tr( "GMSH_SECOND_ORDER" ), GroupC1 );
294 aGroupLayout->addWidget( mySecondOrder, row, 0 );
296 myUseIncomplElem = new QCheckBox( tr( "GMSH_USE_INCOMPLETE_ELEMENT" ), GroupC1 );
297 aGroupLayout->addWidget( myUseIncomplElem, row, 1 );
300 connect( mySecondOrder, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
302 aGroupLayout->addWidget( new QLabel( tr( "GMSH_VERB_LVL" ), GroupC1 ), row, 0 );
303 myVerbLvl = new QComboBox(GroupC1);
304 QStringList typesVerbLvl;
305 typesVerbLvl << tr("GMSH_SILENT") << tr("GMSH_ERRORS") << tr("GMSH_WARNINGS") << tr("GMSH_DIRECT") << tr("GMSH_INFORMATION") << tr("GMSH_STATUS") << tr("GMSH_DEBUG");
306 myVerbLvl->addItems(typesVerbLvl);
307 aGroupLayout->addWidget(myVerbLvl, row, 1);
313 QWidget* compoundGroup = new QWidget();
314 tab->insertTab(1, compoundGroup, tr("GMSH_COMPOUND"));
316 myCompoundTable = new QTableWidget(0, 2, compoundGroup);
317 QGridLayout* compoundLayout = new QGridLayout(compoundGroup);
318 compoundLayout->addWidget(myCompoundTable, 1, 0, 8, 1);
320 QStringList compoundHeaders;
321 compoundHeaders << tr("GMSH_COMPOUND_ENTRY_COLUMN") << tr("GMSH_COMPOUND_NAME_COLUMN");
322 myCompoundTable->setHorizontalHeaderLabels(compoundHeaders);
323 myCompoundTable->horizontalHeader()->hideSection(0);
324 myCompoundTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
325 myCompoundTable->resizeColumnToContents(1);
326 myCompoundTable->setAlternatingRowColors(true);
327 myCompoundTable->verticalHeader()->hide();
329 QPushButton* addCompoundButton = new QPushButton(tr("GMSH_COMPOUND_ADD"), compoundGroup);
330 compoundLayout->addWidget(addCompoundButton, 1, 1, 1, 1);
331 QFrame *line2 = new QFrame(compoundGroup);
333 line2->setFrameShape(QFrame::HLine);
334 line2->setFrameShadow(QFrame::Sunken);
335 compoundLayout->addWidget(line2, 2, 1, 1, 1);
337 QPushButton* removeButton = new QPushButton(tr("GMSH_COMPOUND_REMOVE"), compoundGroup);
338 compoundLayout->addWidget(removeButton, 3, 1, 1, 1);
340 connect(addCompoundButton, SIGNAL(clicked()), this, SLOT(onAddCompound()));
341 connect(removeButton, SIGNAL(clicked()), this, SLOT(onRemoveCompound()));
346 void GMSHPluginGUI_HypothesisCreator::updateWidgets()
348 myUseIncomplElem->setEnabled(mySecondOrder->isChecked());
351 void GMSHPluginGUI_HypothesisCreator::onAddCompound()
353 GMSHPlugin::GMSHPlugin_Hypothesis_var h = GMSHPlugin::GMSHPlugin_Hypothesis::_narrow(initParamsHypothesis());
354 GeomSelectionTools* geomSelectionTools = getGeomSelectionTools();
355 LightApp_SelectionMgr* mySel = geomSelectionTools->selectionMgr();
356 SALOME_ListIO ListSelectedObjects;
357 mySel->selectedObjects(ListSelectedObjects, NULL, false );
358 SALOME_ListIteratorOfListIO Object_It(ListSelectedObjects);
359 for ( ; Object_It.More() ; Object_It.Next())
361 Handle(SALOME_InteractiveObject) anObject = Object_It.Value();
362 std::string entry, shapeName;
363 entry = geomSelectionTools->getEntryOfObject(anObject);
364 shapeName = anObject->getName();
365 TopAbs_ShapeEnum shapeType;
366 shapeType = geomSelectionTools->entryToShapeType(entry);
367 if ((shapeType == TopAbs_SHAPE) || (shapeType != TopAbs_EDGE && shapeType != TopAbs_FACE))
369 myCompoundTable->setFocus();
371 shapeEntry = QString::fromStdString(entry);
372 if (myCompoundSet.contains(shapeEntry))
374 int row = myCompoundTable->rowCount() ;
375 myCompoundTable->setRowCount(row+1);
376 myCompoundTable->setItem(row, 0, new QTableWidgetItem(shapeEntry));
377 myCompoundTable->item(row, 0 )->setFlags(0);
378 myCompoundTable->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(shapeName)));
379 myCompoundTable->item(row, 1 )->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
380 myCompoundTable->resizeColumnToContents(1);
381 myCompoundTable->clearSelection();
382 myCompoundTable->scrollToItem( myCompoundTable->item( row, 1 ) );
383 myCompoundSet.insert(shapeEntry);
384 myCompoundToRemove.remove(shapeEntry);
388 void GMSHPluginGUI_HypothesisCreator::onRemoveCompound()
390 QList<int> selectedRows;
391 QList<QTableWidgetItem*> selected = myCompoundTable->selectedItems();
392 QTableWidgetItem* item;
394 foreach(item, selected)
397 if (!selectedRows.contains(row))
398 selectedRows.append( row );
400 qSort( selectedRows );
401 QListIterator<int> it( selectedRows );
403 while (it.hasPrevious())
406 QString entry = myCompoundTable->item(row,0)->text();
407 if (myCompoundSet.contains(entry))
409 myCompoundSet.remove(entry);
410 myCompoundToRemove.insert(entry);
412 myCompoundTable->removeRow(row );
414 myCompoundTable->resizeColumnToContents(1);
417 void GMSHPluginGUI_HypothesisCreator::retrieveParams() const
419 GmshHypothesisData data;
420 readParamsFromHypo( data );
423 myName->setText( data.myName );
425 my2DAlgo->setCurrentIndex( data.my2DAlgo );
427 my3DAlgo->setCurrentIndex( data.my3DAlgo );
429 myRecomb2DAlgo->setCurrentIndex( data.myRecomb2DAlgo );
430 if ( myRecombineAll )
431 myRecombineAll->setChecked( data.myRecombineAll );
433 mySubdivAlgo->setCurrentIndex( data.mySubdivAlgo );
436 myRemeshAlgo->setCurrentIndex(data.myRemeshAlgo);
437 myRemeshPara->setCurrentIndex(data.myRemeshPara);
439 if(data.mySmouthStepsVar.isEmpty())
440 mySmouthSteps->setValue( data.mySmouthSteps );
442 mySmouthSteps->setText( data.mySmouthStepsVar );
443 if(data.mySizeFactorVar.isEmpty())
444 mySizeFactor->setValue( data.mySizeFactor );
446 mySizeFactor->setText( data.mySizeFactorVar );
447 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
448 if(data.myMeshCurvatureSizeVar.isEmpty())
449 myMeshCurvatureSize->setValue( data.myMeshCurvatureSize );
451 myMeshCurvatureSize->setText( data.myMeshCurvatureSizeVar );
453 if(data.myMaxSizeVar.isEmpty())
454 myMaxSize->setValue( data.myMaxSize );
456 myMaxSize->setText( data.myMaxSizeVar );
457 if(data.myMinSizeVar.isEmpty())
458 myMinSize->setValue( data.myMinSize );
460 myMinSize->setText( data.myMinSizeVar );
462 mySecondOrder->setChecked( data.mySecondOrder );
463 if ( myUseIncomplElem )
464 myUseIncomplElem->setChecked( data.myUseIncomplElem );
466 myVerbLvl->setCurrentIndex(data.myVerbLvl);
468 GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;
469 that->updateWidgets();
473 GeomSelectionTools* geomSelectionTools = that->getGeomSelectionTools();
474 for (QSet<QString>::const_iterator i = myCompoundSet.begin(); i != myCompoundSet.end(); ++i)
476 const QString entry = *i;
477 std::string shapeName = geomSelectionTools->getNameFromEntry(entry.toStdString());
478 int row = myCompoundTable->rowCount();
479 myCompoundTable->setRowCount(row + 1);
480 myCompoundTable->setItem(row, 0, new QTableWidgetItem(entry));
481 myCompoundTable->item(row, 0)->setFlags(0);
482 myCompoundTable->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(shapeName)));
483 myCompoundTable->item(row, 1)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
485 myCompoundTable->resizeColumnToContents(1);
489 QString GMSHPluginGUI_HypothesisCreator::storeParams() const
491 GmshHypothesisData data;
492 readParamsFromWidgets( data );
493 storeParamsToHypo( data );
495 QString valStr = tr("GMSH_MAX_SIZE") + " = " + QString::number( data.myMaxSize ) + "; ";
496 valStr += tr("GMSH_MIN_SIZE") + " = " + QString::number( data.myMinSize ) + "; ";
497 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
498 valStr += tr("GMSH_SIZE_FROM_CURVATURE") + " = " + QString::number( data.myMeshCurvatureSize ) + "; ";
500 if ( data.mySecondOrder )
501 valStr += tr("GMSH_SECOND_ORDER") + "; ";
506 bool GMSHPluginGUI_HypothesisCreator::readParamsFromHypo( GmshHypothesisData& h_data ) const
508 GMSHPlugin::GMSHPlugin_Hypothesis_var h =
509 GMSHPlugin::GMSHPlugin_Hypothesis::_narrow( initParamsHypothesis() );
511 HypothesisData* data = SMESH::GetHypothesisData( hypType() );
512 h_data.myName = isCreation() && data ? data->Label : "";
514 h_data.my2DAlgo = (int) h->Get2DAlgo();
516 h_data.my3DAlgo = (int) h->Get3DAlgo();
517 h_data.myRecomb2DAlgo = (int) h->GetRecomb2DAlgo();
518 h_data.myRecombineAll = h->GetRecombineAll();
519 h_data.mySubdivAlgo = (int) h->GetSubdivAlgo();
520 h_data.myRemeshAlgo = (int) h->GetRemeshAlgo();
521 h_data.myRemeshPara = (int) h->GetRemeshPara();
522 h_data.mySmouthSteps = h->GetSmouthSteps();
523 h_data.mySizeFactor = h->GetSizeFactor();
524 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
525 h_data.myMeshCurvatureSize = h->GetMeshCurvatureSize();
526 h_data.myMeshCurvatureSizeVar = getVariableName("SetMeshCurvatureSize");
528 h_data.myMinSize = h->GetMinSize();
529 h_data.myMaxSize = h->GetMaxSize();
530 h_data.mySmouthStepsVar = getVariableName("SmouthSteps");
531 h_data.mySizeFactorVar = getVariableName("SizeFactor");
532 h_data.myMinSizeVar = getVariableName("SetMinSize");
533 h_data.myMaxSizeVar = getVariableName("SetMaxSize");
534 h_data.mySecondOrder = h->GetSecondOrder();
535 h_data.myUseIncomplElem = h->GetUseIncomplElem();
536 h_data.myVerbLvl = (int) h->GetVerbosityLevel();
538 GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;
539 GMSHPlugin::string_array_var myEntries = h->GetCompoundOnEntries();
540 for ( CORBA::ULong i=0 ; i<myEntries->length() ; i++ )
542 QString entry = myEntries[i].in();
543 that->myCompoundSet.insert(entry);
549 bool GMSHPluginGUI_HypothesisCreator::storeParamsToHypo( const GmshHypothesisData& h_data ) const
551 GMSHPlugin::GMSHPlugin_Hypothesis_var h =
552 GMSHPlugin::GMSHPlugin_Hypothesis::_narrow( hypothesis() );
558 SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
560 h->Set2DAlgo( h_data.my2DAlgo );
562 h->Set3DAlgo( h_data.my3DAlgo );
564 h->SetRecomb2DAlgo( h_data.myRecomb2DAlgo );
565 h->SetRecombineAll( h_data.myRecombineAll );
566 h->SetSubdivAlgo( h_data.mySubdivAlgo );
569 h->SetRemeshAlgo(h_data.myRemeshAlgo);
570 h->SetRemeshPara(h_data.myRemeshPara);
572 h->SetSmouthSteps( h_data.mySmouthSteps );
573 h->SetSizeFactor( h_data.mySizeFactor );
574 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
575 h->SetMeshCurvatureSize( h_data.myMeshCurvatureSize );
577 h->SetMinSize( h_data.myMinSize );
578 h->SetMaxSize( h_data.myMaxSize );
579 h->SetVarParameter( h_data.mySmouthStepsVar.toLatin1().constData(), "SmouthSteps");
580 h->SetVarParameter( h_data.mySizeFactorVar.toLatin1().constData(), "SizeFactor");
581 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
582 h->SetVarParameter( h_data.myMeshCurvatureSizeVar.toLatin1().constData(), "SetMeshCurvatureSize");
584 h->SetVarParameter( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize");
585 h->SetVarParameter( h_data.myMaxSizeVar.toLatin1().constData(), "SetMaxSize");
586 h->SetSecondOrder( h_data.mySecondOrder );
587 h->SetUseIncomplElem( h_data.myUseIncomplElem );
588 h->SetIs2d( myIs2D );
589 h->SetVerbosityLevel(h_data.myVerbLvl);
591 QString mainEntry = getMainShapeEntry();
592 for (QSet<QString>::const_iterator i = myCompoundSet.begin(); i != myCompoundSet.end(); ++i)
595 if ( myCompoundToRemove.contains( entry ))
597 if ( !mainEntry.isEmpty() && !entry.startsWith( mainEntry ))
599 h_data.myErrorMsg = "Compound group is not defined on the main geometry";
603 h->SetCompoundOnEntry(entry.toLatin1().constData());
605 for (QSet<QString>::const_iterator i = myCompoundToRemove.begin(); i != myCompoundToRemove.end(); ++i)
607 const QString entry = *i;
608 h->UnsetCompoundOnEntry(entry.toLatin1().constData());
611 catch(const SALOME::SALOME_Exception& ex)
613 SalomeApp_Tools::QtCatchCorbaException(ex);
619 bool GMSHPluginGUI_HypothesisCreator::readParamsFromWidgets( GmshHypothesisData& h_data ) const
621 h_data.myName = myName ? myName->text() : "";
623 h_data.my2DAlgo = my2DAlgo->currentIndex();
625 h_data.my3DAlgo = my3DAlgo->currentIndex();
627 h_data.myRecomb2DAlgo = myRecomb2DAlgo->currentIndex();
628 h_data.myRecombineAll = myRecombineAll->isChecked();
629 h_data.mySubdivAlgo = mySubdivAlgo->currentIndex();
631 h_data.myRemeshAlgo = myRemeshAlgo->currentIndex();
633 h_data.myRemeshPara = myRemeshPara->currentIndex();
634 h_data.mySmouthSteps = mySmouthSteps->value();
635 h_data.mySizeFactor = mySizeFactor->value();
636 #if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
637 h_data.myMeshCurvatureSize = myMeshCurvatureSize->value();
638 h_data.myMeshCurvatureSizeVar = myMeshCurvatureSize->text();
640 h_data.myMinSize = myMinSize->value();
641 h_data.myMaxSize = myMaxSize->value();
642 h_data.mySmouthStepsVar = mySmouthSteps->text();
643 h_data.mySizeFactorVar = mySizeFactor->text();
644 h_data.myMinSizeVar = myMinSize->text();
645 h_data.myMaxSizeVar = myMaxSize->text();
646 h_data.mySecondOrder = mySecondOrder->isChecked();
647 h_data.myUseIncomplElem = myUseIncomplElem->isChecked();
648 h_data.myVerbLvl = myVerbLvl->currentIndex();
650 // ne semble pas utile dans la mesure ou myCompoundSet n'a pas besoin d'etre modifier
652 GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;
653 int nbRows = myCompoundTable->rowCount();
654 for(int row=0 ; row < nbRows ; row++)
656 QString entry = myLocalSizeTable->item(row, 1)->text();
657 that->myCompoundSet.insert(entry);
663 // on ne modifie rien à partir de là
665 GeomSelectionTools* GMSHPluginGUI_HypothesisCreator::getGeomSelectionTools()
667 if (myGeomSelectionTools == NULL) {
668 myGeomSelectionTools = new GeomSelectionTools();
670 return myGeomSelectionTools;
673 QString GMSHPluginGUI_HypothesisCreator::caption() const
675 return tr( QString( "GMSH_%1_TITLE" ).arg(myIs2D?QString("2D"):QString("3D")).toLatin1().data() );
678 QPixmap GMSHPluginGUI_HypothesisCreator::icon() const
680 QString hypIconName = tr( QString("ICON_DLG_GMSH_PARAMETERS%1").arg(myIs2D?QString("_2D"):QString("")).toLatin1().data() );
681 return SUIT_Session::session()->resourceMgr()->loadPixmap( "GMSHPlugin", hypIconName );
684 QString GMSHPluginGUI_HypothesisCreator::type() const
686 return tr( QString( "GMSH_%1_HYPOTHESIS" ).arg(myIs2D?QString("2D"):QString("3D")).toLatin1().data() );
689 QString GMSHPluginGUI_HypothesisCreator::helpPage() const
691 return "gmsh_2d_3d_hypo_page.html";