1 // Copyright (C) 2004-2015 CEA/DEN, EDF R&D
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, or (at your option) any later version.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // GHS3DPlugin GUI: GUI for plugged-in mesher GHS3DPlugin
21 // File : GHS3DPluginGUI_HypothesisCreator.cxx
22 // Author : Michael Zorin
23 // Module : GHS3DPlugin
25 #include "GHS3DPluginGUI_HypothesisCreator.h"
26 #include "GHS3DPluginGUI_Enums.h"
27 #include "GHS3DPluginGUI_Dlg.h"
29 #include <GeometryGUI.h>
31 #include <SMESHGUI_Utils.h>
32 #include <SMESHGUI_SpinBox.h>
33 #include <SMESHGUI_HypothesesUtils.h>
34 #include <SMESH_NumberFilter.hxx>
35 #include <SMESH_TypeFilter.hxx>
36 #include <StdMeshersGUI_ObjectReferenceParamWdg.h>
38 #include <LightApp_SelectionMgr.h>
39 #include <SUIT_Session.h>
40 #include <SUIT_MessageBox.h>
41 #include <SUIT_ResourceMgr.h>
42 #include <SUIT_FileDlg.h>
43 #include <SalomeApp_Tools.h>
44 #include <SalomeApp_TypeFilter.h>
46 #include <TopoDS_Iterator.hxx>
52 #include <QVBoxLayout>
53 #include <QGridLayout>
58 #include <QPushButton>
62 #include <QTableWidget>
63 #include <QTableWidgetItem>
64 #include <QHeaderView>
67 #include <utilities.h>
69 #include <boost/algorithm/string.hpp>
76 #include <sys/sysinfo.h>
79 long maxAvailableMemory()
82 // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
83 MEMORYSTATUSEX statex;
84 statex.dwLength = sizeof (statex);
85 long err = GlobalMemoryStatusEx (&statex);
88 statex.ullTotalPhys / 1024 / 1024 +
89 statex.ullTotalPageFile / 1024 / 1024 +
90 statex.ullTotalVirtual / 1024 / 1024;
91 return (long) ( 0.7 * totMB );
95 long err = sysinfo( &si );
98 si.totalram * si.mem_unit / 1024 / 1024 +
99 si.totalswap * si.mem_unit / 1024 / 1024 ;
100 return (long) ( 0.7 * totMB );
108 // BEGIN EnforcedVertexTableWidgetDelegate
111 EnforcedVertexTableWidgetDelegate::EnforcedVertexTableWidgetDelegate(QObject *parent)
112 : QItemDelegate(parent)
116 QWidget *EnforcedVertexTableWidgetDelegate::createEditor(QWidget *parent,
117 const QStyleOptionViewItem & option ,
118 const QModelIndex & index ) const
120 QModelIndex father = index.parent();
121 QString entry = father.child(index.row(), ENF_VER_ENTRY_COLUMN).data().toString();
123 if (index.column() == ENF_VER_X_COLUMN ||
124 index.column() == ENF_VER_Y_COLUMN ||
125 index.column() == ENF_VER_Z_COLUMN ||
126 index.column() == ENF_VER_SIZE_COLUMN) {
127 SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
128 if (index.column() == ENF_VER_SIZE_COLUMN)
129 editor->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
131 editor->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
132 editor->setReadOnly(!entry.isEmpty());
133 editor->setDisabled(!entry.isEmpty());
136 // else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
137 // QCheckBox *editor = new QCheckBox(parent);
138 // editor->setDisabled(!entry.isEmpty());
141 else if (index.column() == ENF_VER_GROUP_COLUMN ||
142 index.column() == ENF_VER_NAME_COLUMN) {
144 QLineEdit *editor = new QLineEdit(parent);
145 if (index.column() != ENF_VER_GROUP_COLUMN) {
146 editor->setReadOnly(!entry.isEmpty());
147 editor->setDisabled(!entry.isEmpty());
151 return QItemDelegate::createEditor(parent, option, index);
154 void EnforcedVertexTableWidgetDelegate::setEditorData(QWidget *editor,
155 const QModelIndex &index) const
157 if (index.column() == ENF_VER_X_COLUMN ||
158 index.column() == ENF_VER_Y_COLUMN ||
159 index.column() == ENF_VER_Z_COLUMN ||
160 index.column() == ENF_VER_SIZE_COLUMN)
162 SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
163 lineEdit->SetValue(index.data().toDouble());
165 else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
166 QCheckBox *checkBox = qobject_cast<QCheckBox*>(editor);
167 checkBox->setChecked(index.data().toBool());
170 QItemDelegate::setEditorData(editor, index);
174 void EnforcedVertexTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
175 const QModelIndex &index) const
177 QModelIndex parent = index.parent();
179 QString entry = parent.child(index.row(), ENF_VER_ENTRY_COLUMN).data().toString();
180 bool isCompound = parent.child(index.row(), ENF_VER_COMPOUND_COLUMN).data(Qt::CheckStateRole).toBool();
182 if (index.column() == ENF_VER_X_COLUMN ||
183 index.column() == ENF_VER_Y_COLUMN ||
184 index.column() == ENF_VER_Z_COLUMN) {
185 SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
186 if (!isCompound && !vertexExists(model, index, lineEdit->GetString()))
187 model->setData(index, lineEdit->GetValue(), Qt::EditRole);
189 else if (index.column() == ENF_VER_SIZE_COLUMN)
191 SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
192 const double newsize = lineEdit->GetValue();
194 model->setData(index, newsize, Qt::EditRole);
196 else if (index.column() == ENF_VER_NAME_COLUMN) {
197 QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
198 QString value = lineEdit->text();
199 if (entry.isEmpty() && !vertexExists(model, index, value))
200 model->setData(index, value, Qt::EditRole);
202 else if (index.column() == ENF_VER_ENTRY_COLUMN) {
203 QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
204 QString value = lineEdit->text();
205 if (! vertexExists(model, index, value))
206 model->setData(index, value, Qt::EditRole);
208 else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
209 QCheckBox *checkBox = qobject_cast<QCheckBox*>(editor);
210 model->setData(index, checkBox->isChecked(), Qt::CheckStateRole);
213 QItemDelegate::setModelData(editor, model, index);
217 void EnforcedVertexTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
218 const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
220 editor->setGeometry(option.rect);
223 bool EnforcedVertexTableWidgetDelegate::vertexExists(QAbstractItemModel *model,
224 const QModelIndex &index,
228 QModelIndex parent = index.parent();
229 int row = index.row();
230 int col = index.column();
232 if (parent.isValid() && !value.isEmpty()) {
233 if (col == ENF_VER_X_COLUMN || col == ENF_VER_Y_COLUMN || col == ENF_VER_Z_COLUMN) {
235 if (col == ENF_VER_X_COLUMN) {
236 x = value.toDouble();
237 y = parent.child(row, ENF_VER_Y_COLUMN).data().toDouble();
238 z = parent.child(row, ENF_VER_Z_COLUMN).data().toDouble();
240 if (col == ENF_VER_Y_COLUMN) {
241 y = value.toDouble();
242 x = parent.child(row, ENF_VER_X_COLUMN).data().toDouble();
243 z = parent.child(row, ENF_VER_Z_COLUMN).data().toDouble();
245 if (col == ENF_VER_Z_COLUMN) {
246 z = value.toDouble();
247 x = parent.child(row, ENF_VER_X_COLUMN).data().toDouble();
248 y = parent.child(row, ENF_VER_Y_COLUMN).data().toDouble();
250 int nbChildren = model->rowCount(parent);
251 for (int i = 0 ; i < nbChildren ; i++) {
253 double childX = parent.child(i, ENF_VER_X_COLUMN).data().toDouble();
254 double childY = parent.child(i, ENF_VER_Y_COLUMN).data().toDouble();
255 double childZ = parent.child(i, ENF_VER_Z_COLUMN).data().toDouble();
256 if ((childX == x) && (childY == y) && (childZ == z)) {
263 else if (col == ENF_VER_NAME_COLUMN) {
264 QString name = parent.child(row, ENF_VER_NAME_COLUMN).data().toString();
274 // END EnforcedVertexTableWidgetDelegate
278 // BEGIN EnforcedMeshTableWidgetDelegate
281 EnforcedMeshTableWidgetDelegate::EnforcedMeshTableWidgetDelegate(QObject *parent)
282 : QItemDelegate(parent)
286 QWidget *EnforcedMeshTableWidgetDelegate::createEditor(QWidget *parent,
287 const QStyleOptionViewItem & option ,
288 const QModelIndex & index ) const
290 return QItemDelegate::createEditor(parent, option, index);
293 void EnforcedMeshTableWidgetDelegate::setEditorData(QWidget *editor,
294 const QModelIndex &index) const
296 QItemDelegate::setEditorData(editor, index);
299 void EnforcedMeshTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
300 const QModelIndex &index) const
302 QItemDelegate::setModelData(editor, model, index);
306 void EnforcedMeshTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
307 const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
309 editor->setGeometry(option.rect);
312 // bool EnforcedMeshTableWidgetDelegate::enfMeshExists(QAbstractItemModel *model,
313 // const QModelIndex &index,
314 // QString value) const
316 // bool exists = false;
317 // QModelIndex parent = index.parent();
318 // int row = index.row();
319 // int col = index.column();
324 // END EnforcedMeshTableWidgetDelegate
328 GHS3DPluginGUI_HypothesisCreator::GHS3DPluginGUI_HypothesisCreator( const QString& theHypType )
329 : SMESHGUI_GenericHypothesisCreator( theHypType )
331 GeomToolSelected = NULL;
332 GeomToolSelected = getGeomSelectionTool();
334 iconVertex = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
335 iconCompound = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_COMPOUND")));
336 // mySelectionMgr = SMESH::GetSelectionMgr(SMESHGUI::GetSMESHGUI());
337 myEnfMeshConstraintLabels << tr( "GHS3D_ENF_MESH_CONSTRAINT_NODE" ) << tr( "GHS3D_ENF_MESH_CONSTRAINT_EDGE" ) << tr("GHS3D_ENF_MESH_CONSTRAINT_FACE");
340 GHS3DPluginGUI_HypothesisCreator::~GHS3DPluginGUI_HypothesisCreator()
342 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
343 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
344 myEnfMeshWdg->deactivateSelection();
348 * \brief {Get or create the geom selection tool for active study}
350 GeomSelectionTools* GHS3DPluginGUI_HypothesisCreator::getGeomSelectionTool()
352 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
353 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
354 if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
355 that->GeomToolSelected = new GeomSelectionTools(aStudy);
357 return that->GeomToolSelected;
360 GEOM::GEOM_Gen_var GHS3DPluginGUI_HypothesisCreator::getGeomEngine()
362 return GeometryGUI::GetGeomGen();
365 QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
367 QFrame* fr = new QFrame( 0 );
368 QVBoxLayout* lay = new QVBoxLayout( fr );
370 lay->setSpacing( 0 );
373 QTabWidget* tab = new QTabWidget( fr );
374 tab->setTabShape( QTabWidget::Rounded );
375 tab->setTabPosition( QTabWidget::North );
376 lay->addWidget( tab );
379 myStdGroup = new QWidget();
380 QGridLayout* aStdLayout = new QGridLayout( myStdGroup );
381 aStdLayout->setSpacing( 6 );
382 aStdLayout->setMargin( 11 );
388 aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), row, 0, 1, 1 );
389 myName = new QLineEdit( myStdGroup );
390 aStdLayout->addWidget( myName, row++, 1, 1, 1 );
393 myToMeshHolesCheck = new QCheckBox( tr( "GHS3D_TO_MESH_HOLES" ), myStdGroup );
394 aStdLayout->addWidget( myToMeshHolesCheck, row, 0, 1, 1 );
395 myToMakeGroupsOfDomains = new QCheckBox( tr( "GHS3D_TO_MAKE_DOMAIN_GROUPS" ), myStdGroup );
396 aStdLayout->addWidget( myToMakeGroupsOfDomains, row++, 1, 1, 1 );
398 aStdLayout->addWidget( new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), myStdGroup ), row, 0, 1, 1 );
399 myOptimizationLevelCombo = new QComboBox( myStdGroup );
400 aStdLayout->addWidget( myOptimizationLevelCombo, row++, 1, 1, 1 );
403 types << tr( "LEVEL_NONE" ) << tr( "LEVEL_LIGHT" ) << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STANDARDPLUS" ) << tr( "LEVEL_STRONG" );
404 myOptimizationLevelCombo->addItems( types );
406 aStdLayout->setRowStretch( row, 10 );
408 // advanced parameters
409 myAdvGroup = new QWidget();
410 QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup );
411 anAdvLayout->setSpacing( 6 );
412 anAdvLayout->setMargin( 11 );
413 myAdvWidget = new GHS3DPluginGUI_AdvWidget(myAdvGroup);
414 anAdvLayout->addWidget( myAdvWidget);
416 myAdvWidget->maxMemoryCheck->setText(tr( "MAX_MEMORY_SIZE" ));
417 myAdvWidget->initialMemoryCheck->setText(tr( "INIT_MEMORY_SIZE" ));
419 myAdvWidget->maxMemorySpin->stepBy(10);
420 myAdvWidget->maxMemorySpin->setValue( 128 );
422 myAdvWidget->initialMemorySpin->stepBy(10);
423 myAdvWidget->initialMemorySpin->setValue( 100 );
425 myAdvWidget->initialMemoryLabel ->setText (tr( "MEGABYTE" ));
426 myAdvWidget->maxMemoryLabel ->setText (tr( "MEGABYTE" ));
428 myAdvWidget->workingDirectoryLabel ->setText (tr( "WORKING_DIR" ));
429 myAdvWidget->workingDirectoryPushButton ->setText (tr( "SELECT_DIR" ));
430 myAdvWidget->keepWorkingFilesCheck ->setText (tr( "KEEP_WORKING_FILES" ));
431 myAdvWidget->verboseLevelLabel ->setText (tr( "VERBOSE_LEVEL" ));
432 myAdvWidget->removeLogOnSuccessCheck ->setText (tr( "REMOVE_LOG_ON_SUCCESS" ));
433 myAdvWidget->logInFileCheck ->setText (tr( "LOG_IN_FILE" ));
435 myAdvWidget->memoryGroupBox ->setTitle(tr( "MEMORY_GROUP_TITLE" ));
436 myAdvWidget->logGroupBox ->setTitle(tr( "LOG_GROUP_TITLE" ));
437 myAdvWidget->advancedMeshingGroupBox ->setTitle(tr( "ADVANCED_MESHING_GROUP_TITLE" ));
439 myAdvWidget->createNewNodesCheck ->setText (tr( "TO_ADD_NODES" ));
440 myAdvWidget->removeInitialCentralPointCheck->setText (tr( "NO_INITIAL_CENTRAL_POINT" ));
441 myAdvWidget->boundaryRecoveryCheck ->setText (tr( "RECOVERY_VERSION" ));
442 myAdvWidget->FEMCorrectionCheck ->setText (tr( "FEM_CORRECTION" ));
443 myAdvWidget->gradationLabel ->setText (tr( "GHS3D_GRADATION" ));
444 myAdvWidget->gradationSpinBox->RangeStepAndValidator(1.05, 5.0, 0.05, "length_precision");
445 myAdvWidget->textOptionLabel->setText(tr( "TEXT_OPTION" ));
447 // Enforced vertices parameters
448 myEnfGroup = new QWidget();
449 QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
451 myEnforcedTableWidget = new QTableWidget(myEnfGroup);
452 myEnforcedTableWidget ->setMinimumWidth(300);
453 myEnforcedTableWidget->setRowCount( 0 );
454 myEnforcedTableWidget->setColumnCount( ENF_VER_NB_COLUMNS );
455 myEnforcedTableWidget->setSortingEnabled(true);
456 QStringList enforcedHeaders;
457 enforcedHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
458 << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
459 << tr( "GHS3D_ENF_SIZE_COLUMN" ) << tr("GHS3D_ENF_ENTRY_COLUMN") << tr("GHS3D_ENF_VER_COMPOUND_COLUMN") << tr( "GHS3D_ENF_GROUP_COLUMN" );
461 myEnforcedTableWidget->setHorizontalHeaderLabels(enforcedHeaders);
462 myEnforcedTableWidget->verticalHeader()->hide();
463 myEnforcedTableWidget->horizontalHeader()->setStretchLastSection(true);
464 myEnforcedTableWidget->setAlternatingRowColors(true);
465 myEnforcedTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
466 myEnforcedTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
467 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
468 myEnforcedTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
470 myEnforcedTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
472 myEnforcedTableWidget->resizeColumnsToContents();
473 myEnforcedTableWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
474 myEnforcedTableWidget->hideColumn(ENF_VER_COMPOUND_COLUMN);
476 myEnforcedTableWidget->setItemDelegate(new EnforcedVertexTableWidgetDelegate());
479 TColStd_MapOfInteger shapeTypes;
480 shapeTypes.Add( TopAbs_VERTEX );
481 shapeTypes.Add( TopAbs_COMPOUND );
483 SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes);
484 myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
485 myEnfVertexWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_VERTEX"), "QLineEdit { color: grey }");
487 QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_X_LABEL" ), myEnfGroup );
488 myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
489 myXCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
490 QLabel* myYCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Y_LABEL" ), myEnfGroup );
491 myYCoord = new SMESHGUI_SpinBox(myEnfGroup);
492 myYCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
493 QLabel* myZCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Z_LABEL" ), myEnfGroup );
494 myZCoord = new SMESHGUI_SpinBox(myEnfGroup);
495 myZCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
496 QLabel* mySizeLabel = new QLabel( tr( "GHS3D_ENF_SIZE_LABEL" ), myEnfGroup );
497 mySizeValue = new SMESHGUI_SpinBox(myEnfGroup);
498 mySizeValue->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
500 QLabel* myGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfGroup );
501 myGroupName = new QLineEdit(myEnfGroup);
503 addVertexButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfGroup);
504 addVertexButton->setEnabled(false);
505 removeVertexButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfGroup);
506 // myGlobalGroupName = new QCheckBox(tr("GHS3D_ENF_VER_GROUPS"), myEnfGroup);
507 // myGlobalGroupName->setChecked(false);
509 // QGroupBox* GroupBox = new QGroupBox( myEnfGroup );
510 // QLabel* info = new QLabel( GroupBox );
511 // info->setText( tr( "GHS3D_ENF_VER_INFO" ) );
512 // info->setWordWrap( true );
513 // QVBoxLayout* GroupBoxVLayout = new QVBoxLayout( GroupBox );
514 // GroupBoxVLayout->setSpacing( 6 );
515 // GroupBoxVLayout->setMargin( 11 );
516 // GroupBoxVLayout->addWidget( info );
519 //anEnfLayout->addWidget(GroupBox, ENF_VER_WARNING, 0, 1, 2 );
520 anEnfLayout->addWidget(myEnforcedTableWidget, ENF_VER_VERTEX, 0, ENF_VER_NB_LINES, 1);
522 QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
523 anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
524 anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
525 anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
526 anEnfLayout2->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 0, 1, 1);
527 anEnfLayout2->addWidget(myYCoord, ENF_VER_Y_COORD, 1, 1, 1);
528 anEnfLayout2->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 0, 1, 1);
529 anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1);
530 anEnfLayout2->addWidget(mySizeLabel, ENF_VER_SIZE, 0, 1, 1);
531 anEnfLayout2->addWidget(mySizeValue, ENF_VER_SIZE, 1, 1, 1);
532 anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1);
533 anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1);
534 anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
535 anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
536 anEnfLayout2->setRowStretch(ENF_VER_NB_LINES, 1);
538 anEnfLayout->addLayout(anEnfLayout2, ENF_VER_VERTEX, 1,ENF_VER_NB_LINES, 1);
539 anEnfLayout->setRowStretch(ENF_VER_VERTEX, 10);
542 // Enforced meshes parameters
543 myEnfMeshGroup = new QWidget();
544 QGridLayout* anEnfMeshLayout = new QGridLayout(myEnfMeshGroup);
546 myEnforcedMeshTableWidget = new QTableWidget(myEnfGroup);
547 myEnforcedMeshTableWidget->setRowCount( 0 );
548 myEnforcedMeshTableWidget->setColumnCount( ENF_MESH_NB_COLUMNS );
549 myEnforcedMeshTableWidget->setSortingEnabled(true);
550 myEnforcedMeshTableWidget->verticalHeader()->hide();
551 QStringList enforcedMeshHeaders;
552 enforcedMeshHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
553 << tr( "GHS3D_ENF_ENTRY_COLUMN" )
554 << tr( "GHS3D_ENF_MESH_CONSTRAINT_COLUMN" )
555 << tr( "GHS3D_ENF_GROUP_COLUMN" );
556 myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
557 myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
558 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
559 myEnforcedMeshTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
561 myEnforcedMeshTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
563 myEnforcedMeshTableWidget->setAlternatingRowColors(true);
564 myEnforcedMeshTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
565 myEnforcedMeshTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
566 myEnforcedMeshTableWidget->resizeColumnsToContents();
567 myEnforcedMeshTableWidget->hideColumn(ENF_MESH_ENTRY_COLUMN);
569 myEnforcedMeshTableWidget->setItemDelegate(new EnforcedMeshTableWidgetDelegate());
571 // myEnfMesh = SMESH::SMESH_Mesh::_nil();
572 // myEnfMeshArray = new SMESH::mesh_array();
574 myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( SMESH::IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
575 myEnfMeshWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_MESH"), "QLineEdit { color: grey }");
577 myEnfMeshWdg->AvoidSimultaneousSelection(myEnfVertexWdg);
579 QLabel* myMeshConstraintLabel = new QLabel( tr( "GHS3D_ENF_MESH_CONSTRAINT_LABEL" ), myEnfMeshGroup );
580 myEnfMeshConstraint = new QComboBox(myEnfMeshGroup);
581 myEnfMeshConstraint->insertItems(0,myEnfMeshConstraintLabels);
582 myEnfMeshConstraint->setEditable(false);
583 myEnfMeshConstraint->setCurrentIndex(0);
585 QLabel* myMeshGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfMeshGroup );
586 myMeshGroupName = new QLineEdit(myEnfMeshGroup);
588 addEnfMeshButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfMeshGroup);
589 // addEnfMeshButton->setEnabled(false);
590 removeEnfMeshButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfMeshGroup);
592 // QGroupBox* GroupBox2 = new QGroupBox( myEnfMeshGroup );
593 // QLabel* info2 = new QLabel( GroupBox2 );
594 // info2->setText( tr( "GHS3D_ENF_MESH_INFO" ) );
595 // info2->setWordWrap( true );
596 // QVBoxLayout* GroupBox2VLayout = new QVBoxLayout( GroupBox2 );
597 // GroupBox2VLayout->setSpacing( 6 );
598 // GroupBox2VLayout->setMargin( 11 );
599 // GroupBox2VLayout->addWidget( info2 );
601 // anEnfMeshLayout->addWidget( GroupBox2, ENF_MESH_WARNING, 0, 1, 2 );
602 anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH, 0, ENF_MESH_NB_LINES , 1);
604 QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup);
605 anEnfMeshLayout2->addWidget(myEnfMeshWdg, ENF_MESH_MESH, 0, 1, 2);
606 anEnfMeshLayout2->addWidget(myMeshConstraintLabel, ENF_MESH_CONSTRAINT, 0, 1, 1);
607 anEnfMeshLayout2->addWidget(myEnfMeshConstraint, ENF_MESH_CONSTRAINT, 1, 1, 1);
608 anEnfMeshLayout2->addWidget(myMeshGroupNameLabel, ENF_MESH_GROUP, 0, 1, 1);
609 anEnfMeshLayout2->addWidget(myMeshGroupName, ENF_MESH_GROUP, 1, 1, 1);
610 anEnfMeshLayout2->addWidget(addEnfMeshButton, ENF_MESH_BTN, 0, 1, 1);
611 anEnfMeshLayout2->addWidget(removeEnfMeshButton, ENF_MESH_BTN, 1, 1, 1);
612 anEnfMeshLayout2->setRowStretch(ENF_MESH_NB_LINES, 1);
614 anEnfMeshLayout->addLayout(anEnfMeshLayout2, ENF_MESH_MESH, 1, ENF_MESH_NB_LINES, 1);
615 anEnfMeshLayout->setRowStretch(ENF_MESH_MESH, 10);
618 tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
619 tab->insertTab( ADV_TAB, myAdvGroup, tr( "GHS3D_ADV_ARGS" ) );
620 tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "GHS3D_ENFORCED_VERTICES" ) );
621 tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "GHS3D_ENFORCED_MESHES" ) );
622 tab->setCurrentIndex( STD_TAB );
625 //connect( myToMeshHolesCheck, SIGNAL( toggled( bool ) ), this, SLOT( onToMeshHoles(bool)));
626 connect( myAdvWidget->maxMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
627 connect( myAdvWidget->initialMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
628 connect( myAdvWidget->boundaryRecoveryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
629 connect( myAdvWidget->logInFileCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
630 connect( myAdvWidget->keepWorkingFilesCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
631 connect( myAdvWidget->workingDirectoryPushButton, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) );
633 connect( myEnforcedTableWidget, SIGNAL( itemClicked(QTableWidgetItem *)), this, SLOT( synchronizeCoords() ) );
634 connect( myEnforcedTableWidget, SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
635 connect( myEnforcedTableWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
636 connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertex() ) );
637 connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
638 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
639 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
640 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
641 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
642 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
643 connect( mySizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
644 connect( myXCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
645 connect( myYCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
646 connect( myZCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
647 connect( mySizeValue, SIGNAL( valueChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
648 connect( this, SIGNAL( vertexDefined(bool) ), addVertexButton, SLOT( setEnabled(bool) ) );
650 connect( addEnfMeshButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedMesh() ) );
651 connect( removeEnfMeshButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedMesh() ) );
652 // connect( myEnfMeshWdg, SIGNAL( contentModified()), this, SLOT( checkEnfMeshIsDefined() ) );
653 // connect( myEnfMeshConstraint, SIGNAL( currentIndexChanged(int) ), this, SLOT( checkEnfMeshIsDefined() ) );
654 // connect( this, SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
660 * This method checks if an enforced vertex is defined;
662 void GHS3DPluginGUI_HypothesisCreator::clearEnfVertexSelection()
664 if (myEnfVertexWdg->NbObjects() != 0) {
665 disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
666 disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
667 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
668 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
669 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
671 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
672 that->checkVertexIsDefined();
676 * This method checks if an enforced vertex is defined;
678 void GHS3DPluginGUI_HypothesisCreator::checkVertexIsDefined()
680 bool enfVertexIsDefined = false;
681 enfVertexIsDefined = (!mySizeValue->GetString().isEmpty() &&
682 (!myEnfVertexWdg->NbObjects() == 0 ||
683 (myEnfVertexWdg->NbObjects() == 0 && !myXCoord->GetString().isEmpty()
684 && !myYCoord->GetString().isEmpty()
685 && !myZCoord->GetString().isEmpty())));
686 emit vertexDefined(enfVertexIsDefined);
690 * This method checks if an enforced mesh is defined;
692 void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
694 emit enfMeshDefined( myEnfVertexWdg->NbObjects() != 0);
698 * This method resets the content of the X, Y, Z, size and GroupName widgets;
700 void GHS3DPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
702 myXCoord->setCleared(true);
703 myYCoord->setCleared(true);
704 myZCoord->setCleared(true);
705 // mySizeValue->setCleared(true);
706 myXCoord->setText("");
707 myYCoord->setText("");
708 myZCoord->setText("");
709 // mySizeValue->setText("");
710 // myGroupName->setText("");
711 addVertexButton->setEnabled(false);
714 /** GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item)
715 This method updates the tooltip of a modified item. The QLineEdit widgets content
716 is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
718 void GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item) {
719 // MESSAGE("GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
720 int row = myEnforcedTableWidget->row(item);
722 QVariant vertexName = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole);
723 QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
724 QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
725 QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
726 QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
727 QVariant entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
728 QString groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole).toString();
730 clearEnforcedVertexWidgets();
732 if ( !x.isNull() || !entry.isNull()) {
733 QString toolTip = vertexName.toString();
734 toolTip += QString("(");
735 if (entry.isNull() || (!entry.isNull() && entry.toString() == "")) {
736 toolTip += x.toString();
737 toolTip += QString(", ") + y.toString();
738 toolTip += QString(", ") + z.toString();
741 toolTip += entry.toString();
742 toolTip += QString(")");
745 toolTip += QString("=") + size.toString();
747 if (!groupName.isEmpty())
748 toolTip += QString(" [") + groupName + QString("]");
750 // MESSAGE("Tooltip: " << toolTip.toStdString());
751 for (int col=0;col<ENF_VER_NB_COLUMNS;col++)
752 myEnforcedTableWidget->item(row,col)->setToolTip(toolTip);
755 disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
756 disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
757 disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
758 myXCoord->SetValue(x.toDouble());
759 myYCoord->SetValue(y.toDouble());
760 myZCoord->SetValue(z.toDouble());
761 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
762 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
763 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
766 mySizeValue->SetValue(size.toDouble());
768 if (!groupName.isEmpty())
769 myGroupName->setText(groupName);
773 void GHS3DPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
774 int nbSelEnfVertex = myEnfVertexWdg->NbObjects();
775 clearEnforcedVertexWidgets();
776 if (nbSelEnfVertex == 1)
778 if ( CORBA::is_nil( getGeomEngine() ) && !GeometryGUI::InitGeomGen() )
781 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
782 if (myEnfVertex == GEOM::GEOM_Object::_nil())
784 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
785 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
786 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
787 if (CORBA::is_nil(measureOp))
791 measureOp->PointCoordinates (myEnfVertex, x, y, z);
792 if ( measureOp->IsDone() )
794 disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
795 disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
796 disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
797 myXCoord->SetValue(x);
798 myYCoord->SetValue(y);
799 myZCoord->SetValue(z);
800 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
801 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
802 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
808 /** GHS3DPluginGUI_HypothesisCreator::synchronizeCoords()
809 This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
810 of the enforced vertex clicked in the tree widget.
812 void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() {
813 clearEnforcedVertexWidgets();
814 QList<QTableWidgetItem *> items = myEnforcedTableWidget->selectedItems();
815 // myEnfVertexWdg->disconnect(SIGNAL(contentModified()));
816 disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
817 if (! items.isEmpty()) {
818 QTableWidgetItem *item;
821 if (items.size() == 1) {
823 row = myEnforcedTableWidget->row(item);
824 QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
825 QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
826 QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
827 QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
828 entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
829 if (!entry.isNull()) {
830 SMESH::string_array_var objIds = new SMESH::string_array;
832 objIds[0] = entry.toString().toStdString().c_str();
833 myEnfVertexWdg->SetObjects(objIds);
836 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
838 QVariant group = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole);
839 if (!x.isNull()/* && entry.isNull()*/) {
840 // disconnect( myXCoord, SIGNAL( textChanged(const QString &)), this, SLOT( onSelectEnforcedVertex() ) );
841 disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
842 disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
843 disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
844 myXCoord->SetValue(x.toDouble());
845 myYCoord->SetValue(y.toDouble());
846 myZCoord->SetValue(z.toDouble());
847 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
848 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
849 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
852 mySizeValue->SetValue(size.toDouble());
854 if (!group.isNull() && (!x.isNull() || !entry.isNull()))
855 myGroupName->setText(group.toString());
858 QList<QString> entryList;
859 for (int i = 0; i < items.size(); ++i) {
861 row = myEnforcedTableWidget->row(item);
862 entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
864 entryList << entry.toString();
866 if (entryList.size() > 0) {
867 SMESH::string_array_var objIds = new SMESH::string_array;
868 objIds->length(entryList.size());
869 for (int i = 0; i < entryList.size() ; i++)
870 objIds[i] = entryList.at(i).toStdString().c_str();
871 myEnfVertexWdg->SetObjects(objIds);
874 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
879 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
881 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
882 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
883 that->checkVertexIsDefined();
886 /** GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh( meshName, geomEntry, elemType, size, groupName)
887 This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
889 void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
891 MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
892 bool okToCreate = true;
893 QString itemEntry = "";
894 int itemElementType = 0;
895 int rowCount = myEnforcedMeshTableWidget->rowCount();
896 bool allColumns = true;
897 for (int row = 0;row<rowCount;row++) {
898 for (int col = 0 ; col < ENF_MESH_NB_COLUMNS ; col++) {
899 MESSAGE("col: " << col);
900 if (col == ENF_MESH_CONSTRAINT_COLUMN){
901 if (qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col)) == 0) {
903 MESSAGE("allColumns = false");
907 else if (myEnforcedMeshTableWidget->item(row, col) == 0) {
909 MESSAGE("allColumns = false");
912 if (col == ENF_MESH_CONSTRAINT_COLUMN) {
913 QComboBox* itemComboBox = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col));
914 itemElementType = itemComboBox->currentIndex();
915 MESSAGE("itemElementType: " << itemElementType);
917 else if (col == ENF_MESH_ENTRY_COLUMN)
918 itemEntry = myEnforcedMeshTableWidget->item(row, col)->data(Qt::EditRole).toString();
924 if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) {
925 // // update group name
926 // if (itemGroupName.toStdString() != groupName) {
927 // MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
928 // myEnforcedMeshTableWidget->item(row, ENF_MESH_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
939 MESSAGE("Creation of enforced mesh");
941 myEnforcedMeshTableWidget->setRowCount(rowCount+1);
942 myEnforcedMeshTableWidget->setSortingEnabled(false);
944 for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
945 MESSAGE("Column: " << col);
946 if (col == ENF_MESH_CONSTRAINT_COLUMN) {
947 QComboBox* comboBox = new QComboBox();
948 QPalette pal = comboBox->palette();
949 pal.setColor(QPalette::Button, Qt::white);
950 comboBox->setPalette(pal);
951 comboBox->insertItems(0,myEnfMeshConstraintLabels);
952 comboBox->setEditable(false);
953 comboBox->setCurrentIndex(elementType);
954 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
955 myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
958 QTableWidgetItem* item = new QTableWidgetItem();
959 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
961 case ENF_MESH_NAME_COLUMN:
962 item->setData( 0, name.c_str() );
963 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
964 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
965 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
967 case ENF_MESH_ENTRY_COLUMN:
968 item->setData( 0, entry.c_str() );
969 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
970 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
971 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
973 case ENF_MESH_GROUP_COLUMN:
974 item->setData( 0, groupName.c_str() );
975 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
976 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
985 // connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
987 myEnforcedMeshTableWidget->setSortingEnabled(true);
988 // myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
989 // updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
993 /** GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex( x, y, z, size, vertexName, geomEntry, groupName)
994 This method adds in the tree widget an enforced vertex with given size and coords (x,y,z) or GEOM vertex or compound and with optionally groupName.
996 void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, double size, std::string vertexName, std::string geomEntry, std::string groupName, bool isCompound)
998 MESSAGE("addEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ", \"" << vertexName << ", \"" << geomEntry << "\", \"" << groupName << "\", " << isCompound << ")");
999 myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
1000 bool okToCreate = true;
1001 double itemX,itemY,itemZ,itemSize = 0;
1002 QString itemEntry, itemGroupName = QString("");
1003 // bool itemIsCompound;
1004 int rowCount = myEnforcedTableWidget->rowCount();
1007 for (int row = 0;row<rowCount;row++) {
1009 for (int col = 0 ; col < ENF_VER_NB_COLUMNS ; col++) {
1010 if (myEnforcedTableWidget->item(row, col) == 0) {
1015 data = myEnforcedTableWidget->item(row, col)->data(Qt::EditRole);
1016 if (!data.isNull()) {
1018 case ENF_VER_GROUP_COLUMN:
1019 itemGroupName = data.toString();
1021 case ENF_VER_ENTRY_COLUMN:
1022 itemEntry = data.toString();
1024 // case ENF_VER_COMPOUND_COLUMN:
1025 // itemIsCompound = data.toBool();
1027 case ENF_VER_X_COLUMN:
1028 itemX = data.toDouble();
1030 case ENF_VER_Y_COLUMN:
1031 itemY = data.toDouble();
1033 case ENF_VER_Z_COLUMN:
1034 itemZ = data.toDouble();
1036 case ENF_VER_SIZE_COLUMN:
1037 itemSize = data.toDouble();
1049 if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) ||
1050 ( !itemEntry.isEmpty() && ( itemEntry == geomEntry.c_str() )))
1053 if (itemSize != size) {
1054 MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
1055 myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
1057 // update group name
1058 if (itemGroupName.toStdString() != groupName) {
1059 MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
1060 myEnforcedTableWidget->item(row, ENF_VER_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
1067 if (geomEntry.empty()) {
1068 MESSAGE("Vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
1071 MESSAGE("Vertex with entry " << geomEntry << " already exist: dont create again");
1076 if (geomEntry.empty()) {
1077 MESSAGE("Vertex with coords " << x << ", " << y << ", " << z<< " is created");
1080 MESSAGE("Vertex with geom entry " << geomEntry << " is created");
1085 QString myVertexName;
1086 while(indexRef != vertexIndex) {
1087 indexRef = vertexIndex;
1088 if (vertexName.empty())
1089 myVertexName = QString("Vertex #%1").arg(vertexIndex);
1091 myVertexName = QString(vertexName.c_str());
1093 for (int row = 0;row<rowCount;row++) {
1094 QString name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString();
1095 if (myVertexName == name) {
1102 MESSAGE("myVertexName is \"" << myVertexName.toStdString() << "\"");
1103 myEnforcedTableWidget->setRowCount(rowCount+1);
1104 myEnforcedTableWidget->setSortingEnabled(false);
1105 for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
1106 MESSAGE("Column: " << col);
1107 QTableWidgetItem* item = new QTableWidgetItem();
1108 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1110 case ENF_VER_NAME_COLUMN:
1111 item->setData( Qt::EditRole, myVertexName );
1112 if (!geomEntry.empty()) {
1114 item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1116 item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1119 case ENF_VER_X_COLUMN:
1121 item->setData( 0, QVariant(x) );
1123 case ENF_VER_Y_COLUMN:
1125 item->setData( 0, QVariant(y) );
1127 case ENF_VER_Z_COLUMN:
1129 item->setData( 0, QVariant(z) );
1131 case ENF_VER_SIZE_COLUMN:
1132 item->setData( 0, QVariant(size) );
1134 case ENF_VER_ENTRY_COLUMN:
1135 if (!geomEntry.empty())
1136 item->setData( 0, QString(geomEntry.c_str()) );
1138 case ENF_VER_COMPOUND_COLUMN:
1139 item->setData( Qt::CheckStateRole, isCompound );
1140 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
1142 case ENF_VER_GROUP_COLUMN:
1143 if (!groupName.empty())
1144 item->setData( 0, QString(groupName.c_str()) );
1150 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1151 myEnforcedTableWidget->setItem(rowCount,col,item);
1155 connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1157 myEnforcedTableWidget->setSortingEnabled(true);
1158 // myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1159 updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1162 /** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
1163 This method is called when a item is added into the enforced meshes tree widget
1165 void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
1167 MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()");
1169 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
1171 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1172 myEnfMeshWdg->deactivateSelection();
1174 for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
1175 myEnforcedMeshTableWidget->resizeColumnToContents(column);
1178 int selEnfMeshes = myEnfMeshWdg->NbObjects();
1179 if (selEnfMeshes == 0)
1182 std::string groupName = myMeshGroupName->text().toStdString();
1183 // if (myGlobalGroupName->isChecked())
1184 // groupName = myGlobalGroupName->text().toStdString();
1186 if (boost::trim_copy(groupName).empty())
1190 int elementType = myEnfMeshConstraint->currentIndex();
1193 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1194 _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
1195 QString meshEntry = myEnfMeshWdg->GetValue();
1196 MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
1198 if (selEnfMeshes == 1)
1200 MESSAGE("1 SMESH object selected");
1201 // myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
1202 // std::string entry = myEnfMeshWdg->GetValue();
1203 aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
1204 CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
1205 if (!CORBA::is_nil(anObj)) {
1206 // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
1207 addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
1212 MESSAGE(selEnfMeshes << " SMESH objects selected");
1213 QStringList meshEntries = meshEntry.split(" ", QString::SkipEmptyParts);
1214 QStringListIterator meshEntriesIt (meshEntries);
1215 while (meshEntriesIt.hasNext()) {
1216 aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
1217 CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
1218 if (!CORBA::is_nil(anObj)) {
1219 // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
1220 addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
1225 myEnfVertexWdg->SetObject(SMESH::SMESH_IDSource::_nil());
1227 for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
1228 myEnforcedMeshTableWidget->resizeColumnToContents(column);
1232 /** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
1233 This method is called when a item is added into the enforced vertices tree widget
1235 void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
1237 MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()");
1239 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
1241 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1242 myEnfVertexWdg->deactivateSelection();
1244 for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
1245 myEnforcedTableWidget->resizeColumnToContents(column);
1248 int selEnfVertex = myEnfVertexWdg->NbObjects();
1249 bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
1250 if ((selEnfVertex == 0) && coordsEmpty)
1253 std::string groupName = myGroupName->text().toStdString();
1254 // if (myGlobalGroupName->isChecked())
1255 // groupName = myGlobalGroupName->text().toStdString();
1257 if (boost::trim_copy(groupName).empty())
1260 double size = mySizeValue->GetValue();
1262 if (selEnfVertex <= 1)
1264 MESSAGE("0 or 1 GEOM object selected");
1265 double x = 0, y = 0, z=0;
1266 if (myXCoord->GetString() != "") {
1267 x = myXCoord->GetValue();
1268 y = myYCoord->GetValue();
1269 z = myZCoord->GetValue();
1271 if (selEnfVertex == 1) {
1272 MESSAGE("1 GEOM object selected");
1273 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
1274 std::string entry = "", name = "";
1275 bool isCompound = false;
1276 if ( !myEnfVertex->_is_nil() ) {
1277 entry = SMESH::toStdStr( myEnfVertex->GetStudyEntry() );
1278 name = SMESH::toStdStr( myEnfVertex->GetName() );
1279 isCompound = ( myEnfVertex->GetShapeType() == GEOM::COMPOUND );
1281 addEnforcedVertex(x, y, z, size, name, entry, groupName, isCompound);
1284 MESSAGE("0 GEOM object selected");
1285 MESSAGE("Coords: ("<<x<<","<<y<<","<<z<<")");
1286 addEnforcedVertex(x, y, z, size, "", "", groupName);
1291 if ( CORBA::is_nil(getGeomEngine()))
1294 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
1295 if (CORBA::is_nil(measureOp))
1298 CORBA::Double x = 0, y = 0,z = 0;
1299 for (int j = 0 ; j < selEnfVertex ; j++)
1301 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(j);
1302 if (myEnfVertex == GEOM::GEOM_Object::_nil())
1304 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
1305 measureOp->PointCoordinates (myEnfVertex, x, y, z);
1306 if ( measureOp->IsDone() )
1307 addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
1308 } else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
1309 addEnforcedVertex(0., 0., 0., size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName, true);
1314 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
1316 for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
1317 myEnforcedTableWidget->resizeColumnToContents(column);
1320 /** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
1321 This method is called when a item is removed from the enforced meshes tree widget
1323 void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
1325 QList<int> selectedRows;
1326 QList<QTableWidgetItem *> selectedItems = myEnforcedMeshTableWidget->selectedItems();
1327 QTableWidgetItem* item;
1329 foreach( item, selectedItems ) {
1331 if (!selectedRows.contains( row ) )
1332 selectedRows.append(row);
1335 qSort( selectedRows );
1336 QListIterator<int> it( selectedRows );
1338 while ( it.hasPrevious() ) {
1339 row = it.previous();
1340 MESSAGE("delete row #"<< row);
1341 myEnforcedMeshTableWidget->removeRow(row );
1344 myEnforcedMeshTableWidget->selectionModel()->clearSelection();
1347 /** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
1348 This method is called when a item is removed from the enforced vertices tree widget
1350 void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
1352 QList<int> selectedRows;
1353 QList<QTableWidgetItem *> selectedItems = myEnforcedTableWidget->selectedItems();
1354 QTableWidgetItem* item;
1356 foreach( item, selectedItems ) {
1358 if (!selectedRows.contains( row ) )
1359 selectedRows.append(row);
1362 qSort( selectedRows );
1363 QListIterator<int> it( selectedRows );
1365 while ( it.hasPrevious() ) {
1366 row = it.previous();
1367 MESSAGE("delete row #"<< row);
1368 myEnforcedTableWidget->removeRow(row );
1371 myEnforcedTableWidget->selectionModel()->clearSelection();
1374 void GHS3DPluginGUI_HypothesisCreator::onToMeshHoles(bool isOn)
1376 // myToMakeGroupsOfDomains->setEnabled( isOn );
1378 // myToMakeGroupsOfDomains->setChecked( false );
1381 void GHS3DPluginGUI_HypothesisCreator::onDirBtnClicked()
1383 QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myAdvWidget->workingDirectoryLineEdit->text(), QString() );
1384 if ( !dir.isEmpty() )
1385 myAdvWidget->workingDirectoryLineEdit->setText( dir );
1388 void GHS3DPluginGUI_HypothesisCreator::updateWidgets()
1390 //myToMakeGroupsOfDomains->setEnabled( myToMeshHolesCheck->isChecked() );
1391 myAdvWidget->maxMemorySpin->setEnabled( myAdvWidget->maxMemoryCheck->isChecked() );
1392 myAdvWidget->initialMemoryCheck->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
1393 myAdvWidget->initialMemorySpin->setEnabled( myAdvWidget->initialMemoryCheck->isChecked() && !myAdvWidget->boundaryRecoveryCheck->isChecked() );
1394 myOptimizationLevelCombo->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
1395 if ( sender() == myAdvWidget->logInFileCheck ||
1396 sender() == myAdvWidget->keepWorkingFilesCheck )
1398 bool logFileRemovable = myAdvWidget->logInFileCheck->isChecked() &&
1399 !myAdvWidget->keepWorkingFilesCheck->isChecked();
1401 myAdvWidget->removeLogOnSuccessCheck->setEnabled( logFileRemovable );
1405 bool GHS3DPluginGUI_HypothesisCreator::checkParams(QString& msg) const
1407 MESSAGE("GHS3DPluginGUI_HypothesisCreator::checkParams");
1409 if ( !QFileInfo( myAdvWidget->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
1410 SUIT_MessageBox::warning( dlg(),
1411 tr( "SMESH_WRN_WARNING" ),
1412 tr( "GHS3D_PERMISSION_DENIED" ) );
1419 void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
1421 MESSAGE("GHS3DPluginGUI_HypothesisCreator::retrieveParams");
1422 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
1423 GHS3DHypothesisData data;
1424 readParamsFromHypo( data );
1427 myName->setText( data.myName );
1429 myToMeshHolesCheck ->setChecked ( data.myToMeshHoles );
1430 myToMakeGroupsOfDomains ->setChecked ( data.myToMakeGroupsOfDomains );
1431 myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
1432 myAdvWidget->maxMemoryCheck ->setChecked ( data.myMaximumMemory > 0 );
1433 myAdvWidget->maxMemorySpin ->setValue ( qMax( (int)data.myMaximumMemory,
1434 myAdvWidget->maxMemorySpin->minimum() ));
1435 myAdvWidget->initialMemoryCheck ->setChecked ( data.myInitialMemory > 0 );
1436 myAdvWidget->initialMemorySpin ->setValue ( qMax( (int)data.myInitialMemory,
1437 myAdvWidget->initialMemorySpin->minimum() ));
1438 myAdvWidget->workingDirectoryLineEdit ->setText ( data.myWorkingDir );
1439 myAdvWidget->keepWorkingFilesCheck ->setChecked ( data.myKeepFiles );
1440 myAdvWidget->verboseLevelSpin ->setValue ( data.myVerboseLevel );
1441 myAdvWidget->createNewNodesCheck ->setChecked ( data.myToCreateNewNodes );
1442 myAdvWidget->removeInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint );
1443 myAdvWidget->boundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery );
1444 myAdvWidget->FEMCorrectionCheck ->setChecked ( data.myFEMCorrection );
1445 myAdvWidget->gradationSpinBox ->setValue ( data.myGradation );
1446 myAdvWidget->textOptionLineEdit ->setText ( data.myTextOption );
1447 myAdvWidget->logInFileCheck ->setChecked ( !data.myLogInStandardOutput );
1448 myAdvWidget->removeLogOnSuccessCheck ->setChecked ( data.myRemoveLogOnSuccess );
1450 TEnfVertexList::const_iterator it;
1452 myEnforcedTableWidget->clearContents();
1453 myEnforcedTableWidget->setSortingEnabled(false);
1454 myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
1455 for(it = data.myEnforcedVertices.begin() ; it != data.myEnforcedVertices.end(); it++ )
1457 TEnfVertex* enfVertex = (*it);
1458 myEnforcedTableWidget->setRowCount(rowCount+1);
1460 for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
1461 MESSAGE("Column: " << col);
1462 // MESSAGE("enfVertex->isCompound: " << enfVertex->isCompound);
1463 QTableWidgetItem* item = new QTableWidgetItem();
1464 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1466 case ENF_VER_NAME_COLUMN:
1467 item->setData( 0, enfVertex->name.c_str() );
1468 if (!enfVertex->geomEntry.empty()) {
1469 if (enfVertex->isCompound)
1470 item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1472 item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1474 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1477 case ENF_VER_X_COLUMN:
1478 if (!enfVertex->isCompound) {
1479 item->setData( 0, enfVertex->coords.at(0) );
1480 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1483 case ENF_VER_Y_COLUMN:
1484 if (!enfVertex->isCompound) {
1485 item->setData( 0, enfVertex->coords.at(1) );
1486 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1489 case ENF_VER_Z_COLUMN:
1490 if (!enfVertex->isCompound) {
1491 item->setData( 0, enfVertex->coords.at(2) );
1492 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1495 case ENF_VER_SIZE_COLUMN:
1496 item->setData( 0, enfVertex->size );
1497 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1499 case ENF_VER_ENTRY_COLUMN:
1500 item->setData( 0, enfVertex->geomEntry.c_str() );
1501 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1503 case ENF_VER_COMPOUND_COLUMN:
1504 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
1505 item->setData( Qt::CheckStateRole, enfVertex->isCompound );
1506 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << enfVertex->isCompound);
1508 case ENF_VER_GROUP_COLUMN:
1509 item->setData( 0, enfVertex->groupName.c_str() );
1510 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1516 myEnforcedTableWidget->setItem(rowCount,col,item);
1519 that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1523 connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1524 myEnforcedTableWidget->setSortingEnabled(true);
1526 for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
1527 myEnforcedTableWidget->resizeColumnToContents(column);
1529 // Update Enforced meshes QTableWidget
1530 TEnfMeshList::const_iterator itMesh;
1532 myEnforcedMeshTableWidget->clearContents();
1533 myEnforcedMeshTableWidget->setSortingEnabled(false);
1534 // myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
1535 for(itMesh = data.myEnforcedMeshes.begin() ; itMesh != data.myEnforcedMeshes.end(); itMesh++ )
1537 TEnfMesh* enfMesh = (*itMesh);
1538 myEnforcedMeshTableWidget->setRowCount(rowCount+1);
1540 for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
1541 MESSAGE("Column: " << col);
1542 if (col == ENF_MESH_CONSTRAINT_COLUMN) {
1543 QComboBox* comboBox = new QComboBox();
1544 QPalette pal = comboBox->palette();
1545 pal.setColor(QPalette::Button, Qt::white);
1546 comboBox->setPalette(pal);
1547 comboBox->insertItems(0,myEnfMeshConstraintLabels);
1548 comboBox->setEditable(false);
1549 comboBox->setCurrentIndex(enfMesh->elementType);
1550 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
1551 myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
1554 QTableWidgetItem* item = new QTableWidgetItem();
1555 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1557 case ENF_MESH_NAME_COLUMN:
1558 item->setData( 0, enfMesh->name.c_str() );
1559 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
1560 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1561 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1563 case ENF_MESH_ENTRY_COLUMN:
1564 item->setData( 0, enfMesh->entry.c_str() );
1565 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
1566 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1567 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1569 case ENF_MESH_GROUP_COLUMN:
1570 item->setData( 0, enfMesh->groupName.c_str() );
1571 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1572 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1579 // myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1582 // that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1586 // connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1587 myEnforcedMeshTableWidget->setSortingEnabled(true);
1589 for (int col=0;col<ENF_MESH_NB_COLUMNS;col++)
1590 myEnforcedMeshTableWidget->resizeColumnToContents(col);
1592 that->updateWidgets();
1593 that->checkVertexIsDefined();
1596 QString GHS3DPluginGUI_HypothesisCreator::storeParams() const
1598 MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParams");
1599 GHS3DHypothesisData data;
1600 readParamsFromWidgets( data );
1601 storeParamsToHypo( data );
1603 QString valStr = "";
1605 if ( !data.myBoundaryRecovery )
1606 valStr = " --components " + data.myToMeshHoles ? "all" : "outside_components" ;
1608 if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
1609 const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
1610 valStr += " --optimisation_level ";
1611 valStr += level[ data.myOptimizationLevel ];
1613 if ( data.myMaximumMemory > 0 ) {
1614 valStr += " --max_memory ";
1615 valStr += QString::number( data.myMaximumMemory );
1617 if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
1618 valStr += " --automatic_memory ";
1619 valStr += QString::number( data.myInitialMemory );
1621 valStr += " --verbose ";
1622 valStr += QString::number( data.myVerboseLevel );
1624 if ( !data.myToCreateNewNodes )
1625 valStr += " --no_internal_points";
1627 if ( data.myRemoveInitialCentralPoint )
1628 valStr += " --no_initial_central_point";
1630 if ( data.myBoundaryRecovery )
1633 if ( data.myFEMCorrection )
1636 if ( data.myGradation != 1.05 ) {
1637 valStr += " -Dcpropa=";
1638 valStr += QString::number( data.myGradation );
1642 valStr += data.myTextOption;
1644 // valStr += " #BEGIN ENFORCED VERTICES#";
1645 // // Add size map parameters storage
1646 // for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
1648 // double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
1649 // double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
1650 // double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
1651 // double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
1652 // valStr += QString::number( x );
1654 // valStr += QString::number( y );
1656 // valStr += QString::number( z );
1658 // valStr += QString::number( size );
1659 // if (i!=mySmpModel->rowCount()-1)
1662 // valStr += " #END ENFORCED VERTICES#";
1663 // MESSAGE(valStr.toStdString());
1667 bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data ) const
1669 MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo");
1670 GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
1671 GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( initParamsHypothesis() );
1673 HypothesisData* data = SMESH::GetHypothesisData( hypType() );
1674 h_data.myName = isCreation() && data ? hypName() : "";
1676 h_data.myToMeshHoles = h->GetToMeshHoles();
1677 h_data.myToMakeGroupsOfDomains = /*h->GetToMeshHoles() &&*/ h->GetToMakeGroupsOfDomains();
1678 h_data.myMaximumMemory = h->GetMaximumMemory();
1679 h_data.myInitialMemory = h->GetInitialMemory();
1680 h_data.myInitialMemory = h->GetInitialMemory();
1681 h_data.myOptimizationLevel = h->GetOptimizationLevel();
1682 h_data.myKeepFiles = h->GetKeepFiles();
1683 h_data.myWorkingDir = h->GetWorkingDirectory();
1684 h_data.myVerboseLevel = h->GetVerboseLevel();
1685 h_data.myToCreateNewNodes = h->GetToCreateNewNodes();
1686 h_data.myRemoveInitialCentralPoint = h->GetToRemoveCentralPoint();
1687 h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion();
1688 h_data.myFEMCorrection = h->GetFEMCorrection();
1689 h_data.myGradation = h->GetGradation();
1690 h_data.myTextOption = h->GetTextOption();
1691 h_data.myLogInStandardOutput = h->GetStandardOutputLog();
1692 h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess();
1694 GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
1695 MESSAGE("vertices->length(): " << vertices->length());
1696 h_data.myEnforcedVertices.clear();
1697 for (int i=0 ; i<vertices->length() ; i++) {
1698 TEnfVertex* myVertex = new TEnfVertex();
1699 myVertex->name = CORBA::string_dup(vertices[i].name.in());
1700 myVertex->geomEntry = CORBA::string_dup(vertices[i].geomEntry.in());
1701 myVertex->groupName = CORBA::string_dup(vertices[i].groupName.in());
1702 myVertex->size = vertices[i].size;
1703 myVertex->isCompound = vertices[i].isCompound;
1704 if (vertices[i].coords.length()) {
1705 for (int c = 0; c < vertices[i].coords.length() ; c++)
1706 myVertex->coords.push_back(vertices[i].coords[c]);
1707 MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
1709 h_data.myEnforcedVertices.insert(myVertex);
1712 GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
1713 MESSAGE("enfMeshes->length(): " << enfMeshes->length());
1714 h_data.myEnforcedMeshes.clear();
1715 for (int i=0 ; i<enfMeshes->length() ; i++) {
1716 TEnfMesh* myEnfMesh = new TEnfMesh();
1717 myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
1718 myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
1719 myEnfMesh->groupName = CORBA::string_dup(enfMeshes[i].groupName.in());
1720 switch (enfMeshes[i].elementType) {
1722 myEnfMesh->elementType = 0;
1725 myEnfMesh->elementType = 1;
1728 myEnfMesh->elementType = 2;
1733 // myEnfMesh->elementType = enfMeshes[i].elementType;
1734 h_data.myEnforcedMeshes.insert(myEnfMesh);
1739 bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisData& h_data ) const
1741 MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo");
1742 GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
1743 GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( hypothesis() );
1749 SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
1751 if ( h->GetToMeshHoles() != h_data.myToMeshHoles ) // avoid duplication of DumpPython commands
1752 h->SetToMeshHoles ( h_data.myToMeshHoles );
1753 if ( h->GetToMakeGroupsOfDomains() != h_data.myToMakeGroupsOfDomains )
1754 h->SetToMakeGroupsOfDomains( h_data.myToMakeGroupsOfDomains );
1755 if ( h->GetMaximumMemory() != h_data.myMaximumMemory )
1756 h->SetMaximumMemory ( h_data.myMaximumMemory );
1757 if ( h->GetInitialMemory() != h_data.myInitialMemory )
1758 h->SetInitialMemory ( h_data.myInitialMemory );
1759 if ( h->GetInitialMemory() != h_data.myInitialMemory )
1760 h->SetInitialMemory ( h_data.myInitialMemory );
1761 if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel )
1762 h->SetOptimizationLevel( h_data.myOptimizationLevel );
1763 if ( h->GetKeepFiles() != h_data.myKeepFiles )
1764 h->SetKeepFiles ( h_data.myKeepFiles );
1765 if ( h->GetWorkingDirectory() != h_data.myWorkingDir )
1766 h->SetWorkingDirectory ( h_data.myWorkingDir.toLatin1().constData() );
1767 if ( h->GetVerboseLevel() != h_data.myVerboseLevel )
1768 h->SetVerboseLevel ( h_data.myVerboseLevel );
1769 if ( h->GetToCreateNewNodes() != h_data.myToCreateNewNodes )
1770 h->SetToCreateNewNodes( h_data.myToCreateNewNodes );
1771 if ( h->GetToRemoveCentralPoint() != h_data.myRemoveInitialCentralPoint )
1772 h->SetToRemoveCentralPoint( h_data.myRemoveInitialCentralPoint );
1773 if ( h->GetToUseBoundaryRecoveryVersion() != h_data.myBoundaryRecovery )
1774 h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery );
1775 if ( h->GetFEMCorrection() != h_data.myFEMCorrection )
1776 h->SetFEMCorrection ( h_data.myFEMCorrection );
1777 if ( h->GetGradation() != h_data.myGradation )
1778 h->SetGradation ( h_data.myGradation );
1779 if ( h->GetTextOption() != h_data.myTextOption )
1780 h->SetTextOption ( h_data.myTextOption.toLatin1().constData() );
1781 if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput )
1782 h->SetStandardOutputLog( h_data.myLogInStandardOutput );
1783 if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
1784 h->SetRemoveLogOnSuccess( h_data.myRemoveLogOnSuccess );
1786 // Enforced vertices
1787 int nbVertex = (int) h_data.myEnforcedVertices.size();
1788 GHS3DPlugin::GHS3DEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices();
1789 int nbVertexHyp = vertexHyp->length();
1791 MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices");
1792 MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp);
1794 // 1. Clear all enforced vertices in hypothesis
1795 // 2. Add new enforced vertex according to h_data
1796 if ( nbVertexHyp > 0)
1797 h->ClearEnforcedVertices();
1799 TEnfVertexList::const_iterator it;
1800 double x = 0, y = 0, z = 0;
1801 for(it = h_data.myEnforcedVertices.begin() ; it != h_data.myEnforcedVertices.end(); it++ ) {
1802 TEnfVertex* enfVertex = (*it);
1804 if (enfVertex->coords.size()) {
1805 x = enfVertex->coords.at(0);
1806 y = enfVertex->coords.at(1);
1807 z = enfVertex->coords.at(2);
1809 ok = h->p_SetEnforcedVertex( enfVertex->size, x, y, z, enfVertex->name.c_str(), enfVertex->geomEntry.c_str(), enfVertex->groupName.c_str(), enfVertex->isCompound);
1813 int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
1814 GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshListHyp = h->GetEnforcedMeshes();
1815 int nbEnfMeshListHyp = enfMeshListHyp->length();
1817 MESSAGE("Store params for size maps: " << nbEnfMeshes << " enforced meshes");
1818 MESSAGE("h->GetEnforcedMeshes()->length(): " << nbEnfMeshListHyp);
1820 // 1. Clear all enforced vertices in hypothesis
1821 // 2. Add new enforced vertex according to h_data
1822 if ( nbEnfMeshListHyp > 0)
1823 h->ClearEnforcedMeshes();
1825 TEnfMeshList::const_iterator itEnfMesh;
1827 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1829 for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
1830 TEnfMesh* enfMesh = (*itEnfMesh);
1832 _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
1833 SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
1835 MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
1836 SMESH::ElementType elementType;
1837 switch(enfMesh->elementType) {
1839 elementType = SMESH::NODE;
1842 elementType = SMESH::EDGE;
1845 elementType = SMESH::FACE;
1851 std::cout << "h->p_SetEnforcedMesh(theSource, "<< elementType <<", \""<< enfMesh->name << "\", \"" << enfMesh->groupName.c_str() <<"\")"<<std::endl;
1852 ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str());
1855 // catch(const std::exception& ex) {
1856 // std::cout << "Exception: " << ex.what() << std::endl;
1859 catch ( const SALOME::SALOME_Exception& ex )
1861 SalomeApp_Tools::QtCatchCorbaException( ex );
1867 bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisData& h_data ) const
1869 MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets");
1870 h_data.myName = myName ? myName->text() : "";
1871 h_data.myToMeshHoles = myToMeshHolesCheck->isChecked();
1872 h_data.myToMakeGroupsOfDomains = myToMakeGroupsOfDomains->isChecked();
1873 h_data.myMaximumMemory = myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1;
1874 h_data.myInitialMemory = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1;
1875 h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex();
1876 h_data.myKeepFiles = myAdvWidget->keepWorkingFilesCheck->isChecked();
1877 h_data.myWorkingDir = myAdvWidget->workingDirectoryLineEdit->text().trimmed();
1878 h_data.myVerboseLevel = myAdvWidget->verboseLevelSpin->value();
1879 h_data.myToCreateNewNodes = myAdvWidget->createNewNodesCheck->isChecked();
1880 h_data.myRemoveInitialCentralPoint = myAdvWidget->removeInitialCentralPointCheck->isChecked();
1881 h_data.myBoundaryRecovery = myAdvWidget->boundaryRecoveryCheck->isChecked();
1882 h_data.myFEMCorrection = myAdvWidget->FEMCorrectionCheck->isChecked();
1883 h_data.myGradation = myAdvWidget->gradationSpinBox->value();
1884 h_data.myTextOption = myAdvWidget->textOptionLineEdit->text();
1885 h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked();
1886 h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked();
1888 // Enforced vertices
1889 h_data.myEnforcedVertices.clear();
1890 QVariant valueX, valueY, valueZ;
1891 for (int row=0 ; row<myEnforcedTableWidget->rowCount() ; row++) {
1893 TEnfVertex *myVertex = new TEnfVertex();
1894 myVertex->name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
1895 MESSAGE("Add new enforced vertex \"" << myVertex->name << "\"" );
1896 myVertex->geomEntry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
1897 if (myVertex->geomEntry.size())
1898 MESSAGE("Geom entry is \"" << myVertex->geomEntry << "\"" );
1899 myVertex->groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
1900 if (myVertex->groupName.size())
1901 MESSAGE("Group name is \"" << myVertex->groupName << "\"" );
1902 valueX = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data(Qt::EditRole);
1903 valueY = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data(Qt::EditRole);
1904 valueZ = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data(Qt::EditRole);
1905 if (!valueX.isNull() && !valueY.isNull() && !valueZ.isNull()) {
1906 myVertex->coords.push_back(valueX.toDouble());
1907 myVertex->coords.push_back(valueY.toDouble());
1908 myVertex->coords.push_back(valueZ.toDouble());
1909 MESSAGE("Coords are (" << myVertex->coords.at(0) << ", "
1910 << myVertex->coords.at(1) << ", "
1911 << myVertex->coords.at(2) << ")");
1913 myVertex->size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
1914 MESSAGE("Size is " << myVertex->size);
1915 myVertex->isCompound = myEnforcedTableWidget->item(row,ENF_VER_COMPOUND_COLUMN)->data(Qt::CheckStateRole).toBool();
1916 MESSAGE("Is compound ? " << myVertex->isCompound);
1917 h_data.myEnforcedVertices.insert(myVertex);
1921 h_data.myEnforcedMeshes.clear();
1923 for (int row=0 ; row<myEnforcedMeshTableWidget->rowCount() ; row++) {
1925 TEnfMesh *myEnfMesh = new TEnfMesh();
1926 myEnfMesh->name = myEnforcedMeshTableWidget->item(row,ENF_MESH_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
1927 MESSAGE("Add new enforced mesh \"" << myEnfMesh->name << "\"" );
1928 myEnfMesh->entry = myEnforcedMeshTableWidget->item(row,ENF_MESH_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
1929 MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
1930 myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
1931 MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
1932 QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
1933 myEnfMesh->elementType = combo->currentIndex();
1934 MESSAGE("Element type: " << myEnfMesh->elementType);
1935 h_data.myEnforcedMeshes.insert(myEnfMesh);
1936 std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
1942 QString GHS3DPluginGUI_HypothesisCreator::caption() const
1944 return tr( "GHS3D_TITLE" );
1947 QPixmap GHS3DPluginGUI_HypothesisCreator::icon() const
1949 return SUIT_Session::session()->resourceMgr()->loadPixmap( "GHS3DPlugin", tr( "ICON_DLG_GHS3D_PARAMETERS" ) );
1952 QString GHS3DPluginGUI_HypothesisCreator::type() const
1954 return tr( "GHS3D_HYPOTHESIS" );
1957 QString GHS3DPluginGUI_HypothesisCreator::helpPage() const
1959 return "ghs3d_hypo_page.html";