1 // Copyright (C) 2004-2013 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.
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 int maxAvailableMemory()
82 // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
83 MEMORYSTATUSEX statex;
84 statex.dwLength = sizeof (statex);
85 int err = GlobalMemoryStatusEx (&statex);
88 statex.ullTotalPhys / 1024 / 1024 +
89 statex.ullTotalPageFile / 1024 / 1024 +
90 statex.ullTotalVirtual / 1024 / 1024;
91 return (int) ( 0.7 * totMB );
95 int err = sysinfo( &si );
98 si.totalram * si.mem_unit / 1024 / 1024 +
99 si.totalswap * si.mem_unit / 1024 / 1024 ;
100 return (int) ( 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->RangeStepAndValidator(20.0, 1e6, 10.0);
420 myAdvWidget->maxMemorySpin->setValue( 128.0 );
422 myAdvWidget->initialMemorySpin->RangeStepAndValidator(0.0, 1e6, 10.0);
423 myAdvWidget->initialMemorySpin->setValue( 100.0 );
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 myEnforcedTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
468 myEnforcedTableWidget->resizeColumnsToContents();
469 myEnforcedTableWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
470 myEnforcedTableWidget->hideColumn(ENF_VER_COMPOUND_COLUMN);
472 myEnforcedTableWidget->setItemDelegate(new EnforcedVertexTableWidgetDelegate());
475 TColStd_MapOfInteger shapeTypes;
476 shapeTypes.Add( TopAbs_VERTEX );
477 shapeTypes.Add( TopAbs_COMPOUND );
479 SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes);
480 myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true, /*stretch=*/false);
481 myEnfVertexWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_VERTEX"), "QLineEdit { color: grey }");
483 QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_X_LABEL" ), myEnfGroup );
484 myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
485 myXCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
486 QLabel* myYCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Y_LABEL" ), myEnfGroup );
487 myYCoord = new SMESHGUI_SpinBox(myEnfGroup);
488 myYCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
489 QLabel* myZCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Z_LABEL" ), myEnfGroup );
490 myZCoord = new SMESHGUI_SpinBox(myEnfGroup);
491 myZCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
492 QLabel* mySizeLabel = new QLabel( tr( "GHS3D_ENF_SIZE_LABEL" ), myEnfGroup );
493 mySizeValue = new SMESHGUI_SpinBox(myEnfGroup);
494 mySizeValue->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
496 QLabel* myGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfGroup );
497 myGroupName = new QLineEdit(myEnfGroup);
499 addVertexButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfGroup);
500 addVertexButton->setEnabled(false);
501 removeVertexButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfGroup);
502 // myGlobalGroupName = new QCheckBox(tr("GHS3D_ENF_VER_GROUPS"), myEnfGroup);
503 // myGlobalGroupName->setChecked(false);
505 // QGroupBox* GroupBox = new QGroupBox( myEnfGroup );
506 // QLabel* info = new QLabel( GroupBox );
507 // info->setText( tr( "GHS3D_ENF_VER_INFO" ) );
508 // info->setWordWrap( true );
509 // QVBoxLayout* GroupBoxVLayout = new QVBoxLayout( GroupBox );
510 // GroupBoxVLayout->setSpacing( 6 );
511 // GroupBoxVLayout->setMargin( 11 );
512 // GroupBoxVLayout->addWidget( info );
515 //anEnfLayout->addWidget(GroupBox, ENF_VER_WARNING, 0, 1, 2 );
516 anEnfLayout->addWidget(myEnforcedTableWidget, ENF_VER_VERTEX, 0, ENF_VER_NB_LINES, 1);
518 QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
519 anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
520 anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
521 anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
522 anEnfLayout2->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 0, 1, 1);
523 anEnfLayout2->addWidget(myYCoord, ENF_VER_Y_COORD, 1, 1, 1);
524 anEnfLayout2->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 0, 1, 1);
525 anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1);
526 anEnfLayout2->addWidget(mySizeLabel, ENF_VER_SIZE, 0, 1, 1);
527 anEnfLayout2->addWidget(mySizeValue, ENF_VER_SIZE, 1, 1, 1);
528 anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1);
529 anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1);
530 anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
531 anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
532 anEnfLayout2->setRowStretch(ENF_VER_NB_LINES, 1);
534 anEnfLayout->addLayout(anEnfLayout2, ENF_VER_VERTEX, 1,ENF_VER_NB_LINES, 1);
535 anEnfLayout->setRowStretch(ENF_VER_VERTEX, 10);
538 // Enforced meshes parameters
539 myEnfMeshGroup = new QWidget();
540 QGridLayout* anEnfMeshLayout = new QGridLayout(myEnfMeshGroup);
542 myEnforcedMeshTableWidget = new QTableWidget(myEnfGroup);
543 myEnforcedMeshTableWidget->setRowCount( 0 );
544 myEnforcedMeshTableWidget->setColumnCount( ENF_MESH_NB_COLUMNS );
545 myEnforcedMeshTableWidget->setSortingEnabled(true);
546 myEnforcedMeshTableWidget->verticalHeader()->hide();
547 QStringList enforcedMeshHeaders;
548 enforcedMeshHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
549 << tr( "GHS3D_ENF_ENTRY_COLUMN" )
550 << tr( "GHS3D_ENF_MESH_CONSTRAINT_COLUMN" )
551 << tr( "GHS3D_ENF_GROUP_COLUMN" );
552 myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
553 myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
554 myEnforcedMeshTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
555 myEnforcedMeshTableWidget->setAlternatingRowColors(true);
556 myEnforcedMeshTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
557 myEnforcedMeshTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
558 myEnforcedMeshTableWidget->resizeColumnsToContents();
559 myEnforcedMeshTableWidget->hideColumn(ENF_MESH_ENTRY_COLUMN);
561 myEnforcedMeshTableWidget->setItemDelegate(new EnforcedMeshTableWidgetDelegate());
563 // myEnfMesh = SMESH::SMESH_Mesh::_nil();
564 // myEnfMeshArray = new SMESH::mesh_array();
566 myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( SMESH::IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
567 myEnfMeshWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_MESH"), "QLineEdit { color: grey }");
569 myEnfMeshWdg->AvoidSimultaneousSelection(myEnfVertexWdg);
571 QLabel* myMeshConstraintLabel = new QLabel( tr( "GHS3D_ENF_MESH_CONSTRAINT_LABEL" ), myEnfMeshGroup );
572 myEnfMeshConstraint = new QComboBox(myEnfMeshGroup);
573 myEnfMeshConstraint->insertItems(0,myEnfMeshConstraintLabels);
574 myEnfMeshConstraint->setEditable(false);
575 myEnfMeshConstraint->setCurrentIndex(0);
577 QLabel* myMeshGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfMeshGroup );
578 myMeshGroupName = new QLineEdit(myEnfMeshGroup);
580 addEnfMeshButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfMeshGroup);
581 // addEnfMeshButton->setEnabled(false);
582 removeEnfMeshButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfMeshGroup);
584 // QGroupBox* GroupBox2 = new QGroupBox( myEnfMeshGroup );
585 // QLabel* info2 = new QLabel( GroupBox2 );
586 // info2->setText( tr( "GHS3D_ENF_MESH_INFO" ) );
587 // info2->setWordWrap( true );
588 // QVBoxLayout* GroupBox2VLayout = new QVBoxLayout( GroupBox2 );
589 // GroupBox2VLayout->setSpacing( 6 );
590 // GroupBox2VLayout->setMargin( 11 );
591 // GroupBox2VLayout->addWidget( info2 );
593 // anEnfMeshLayout->addWidget( GroupBox2, ENF_MESH_WARNING, 0, 1, 2 );
594 anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH, 0, ENF_MESH_NB_LINES , 1);
596 QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup);
597 anEnfMeshLayout2->addWidget(myEnfMeshWdg, ENF_MESH_MESH, 0, 1, 2);
598 anEnfMeshLayout2->addWidget(myMeshConstraintLabel, ENF_MESH_CONSTRAINT, 0, 1, 1);
599 anEnfMeshLayout2->addWidget(myEnfMeshConstraint, ENF_MESH_CONSTRAINT, 1, 1, 1);
600 anEnfMeshLayout2->addWidget(myMeshGroupNameLabel, ENF_MESH_GROUP, 0, 1, 1);
601 anEnfMeshLayout2->addWidget(myMeshGroupName, ENF_MESH_GROUP, 1, 1, 1);
602 anEnfMeshLayout2->addWidget(addEnfMeshButton, ENF_MESH_BTN, 0, 1, 1);
603 anEnfMeshLayout2->addWidget(removeEnfMeshButton, ENF_MESH_BTN, 1, 1, 1);
604 anEnfMeshLayout2->setRowStretch(ENF_MESH_NB_LINES, 1);
606 anEnfMeshLayout->addLayout(anEnfMeshLayout2, ENF_MESH_MESH, 1, ENF_MESH_NB_LINES, 1);
607 anEnfMeshLayout->setRowStretch(ENF_MESH_MESH, 10);
610 tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
611 tab->insertTab( ADV_TAB, myAdvGroup, tr( "GHS3D_ADV_ARGS" ) );
612 tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "GHS3D_ENFORCED_VERTICES" ) );
613 tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "GHS3D_ENFORCED_MESHES" ) );
614 tab->setCurrentIndex( STD_TAB );
617 //connect( myToMeshHolesCheck, SIGNAL( toggled( bool ) ), this, SLOT( onToMeshHoles(bool)));
618 connect( myAdvWidget->maxMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
619 connect( myAdvWidget->initialMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
620 connect( myAdvWidget->boundaryRecoveryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
621 connect( myAdvWidget->logInFileCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
622 connect( myAdvWidget->keepWorkingFilesCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
623 connect( myAdvWidget->workingDirectoryPushButton, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) );
625 connect( myEnforcedTableWidget, SIGNAL( itemClicked(QTableWidgetItem *)), this, SLOT( synchronizeCoords() ) );
626 connect( myEnforcedTableWidget, SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
627 connect( myEnforcedTableWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
628 connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertex() ) );
629 connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
630 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
631 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
632 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
633 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
634 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
635 connect( mySizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
636 connect( myXCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
637 connect( myYCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
638 connect( myZCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
639 connect( mySizeValue, SIGNAL( valueChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
640 connect( this, SIGNAL( vertexDefined(bool) ), addVertexButton, SLOT( setEnabled(bool) ) );
642 connect( addEnfMeshButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedMesh() ) );
643 connect( removeEnfMeshButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedMesh() ) );
644 // connect( myEnfMeshWdg, SIGNAL( contentModified()), this, SLOT( checkEnfMeshIsDefined() ) );
645 // connect( myEnfMeshConstraint, SIGNAL( currentIndexChanged(int) ), this, SLOT( checkEnfMeshIsDefined() ) );
646 // connect( this, SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
652 * This method checks if an enforced vertex is defined;
654 void GHS3DPluginGUI_HypothesisCreator::clearEnfVertexSelection()
656 if (myEnfVertexWdg->NbObjects() != 0) {
657 disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
658 disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
659 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
660 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
661 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
663 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
664 that->checkVertexIsDefined();
668 * This method checks if an enforced vertex is defined;
670 void GHS3DPluginGUI_HypothesisCreator::checkVertexIsDefined()
672 bool enfVertexIsDefined = false;
673 enfVertexIsDefined = (!mySizeValue->GetString().isEmpty() &&
674 (!myEnfVertexWdg->NbObjects() == 0 ||
675 (myEnfVertexWdg->NbObjects() == 0 && !myXCoord->GetString().isEmpty()
676 && !myYCoord->GetString().isEmpty()
677 && !myZCoord->GetString().isEmpty())));
678 emit vertexDefined(enfVertexIsDefined);
682 * This method checks if an enforced mesh is defined;
684 void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
686 emit enfMeshDefined( myEnfVertexWdg->NbObjects() != 0);
690 * This method resets the content of the X, Y, Z, size and GroupName widgets;
692 void GHS3DPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
694 myXCoord->setCleared(true);
695 myYCoord->setCleared(true);
696 myZCoord->setCleared(true);
697 // mySizeValue->setCleared(true);
698 myXCoord->setText("");
699 myYCoord->setText("");
700 myZCoord->setText("");
701 // mySizeValue->setText("");
702 // myGroupName->setText("");
703 addVertexButton->setEnabled(false);
706 /** GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item)
707 This method updates the tooltip of a modified item. The QLineEdit widgets content
708 is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
710 void GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item) {
711 // MESSAGE("GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
712 int row = myEnforcedTableWidget->row(item);
714 QVariant vertexName = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole);
715 QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
716 QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
717 QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
718 QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
719 QVariant entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
720 QString groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole).toString();
722 clearEnforcedVertexWidgets();
724 if ( !x.isNull() || !entry.isNull()) {
725 QString toolTip = vertexName.toString();
726 toolTip += QString("(");
727 if (entry.isNull() || (!entry.isNull() && entry.toString() == "")) {
728 toolTip += x.toString();
729 toolTip += QString(", ") + y.toString();
730 toolTip += QString(", ") + z.toString();
733 toolTip += entry.toString();
734 toolTip += QString(")");
737 toolTip += QString("=") + size.toString();
739 if (!groupName.isEmpty())
740 toolTip += QString(" [") + groupName + QString("]");
742 // MESSAGE("Tooltip: " << toolTip.toStdString());
743 for (int col=0;col<ENF_VER_NB_COLUMNS;col++)
744 myEnforcedTableWidget->item(row,col)->setToolTip(toolTip);
747 disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
748 disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
749 disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
750 myXCoord->SetValue(x.toDouble());
751 myYCoord->SetValue(y.toDouble());
752 myZCoord->SetValue(z.toDouble());
753 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
754 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
755 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
758 mySizeValue->SetValue(size.toDouble());
760 if (!groupName.isEmpty())
761 myGroupName->setText(groupName);
765 void GHS3DPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
766 int nbSelEnfVertex = myEnfVertexWdg->NbObjects();
767 clearEnforcedVertexWidgets();
768 if (nbSelEnfVertex == 1)
770 if ( CORBA::is_nil( getGeomEngine() ) && !GeometryGUI::InitGeomGen() )
773 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
774 if (myEnfVertex == GEOM::GEOM_Object::_nil())
776 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
777 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
778 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
779 if (CORBA::is_nil(measureOp))
783 measureOp->PointCoordinates (myEnfVertex, x, y, z);
784 if ( measureOp->IsDone() )
786 disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
787 disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
788 disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
789 myXCoord->SetValue(x);
790 myYCoord->SetValue(y);
791 myZCoord->SetValue(z);
792 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
793 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
794 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
800 /** GHS3DPluginGUI_HypothesisCreator::synchronizeCoords()
801 This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
802 of the enforced vertex clicked in the tree widget.
804 void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() {
805 clearEnforcedVertexWidgets();
806 QList<QTableWidgetItem *> items = myEnforcedTableWidget->selectedItems();
807 // myEnfVertexWdg->disconnect(SIGNAL(contentModified()));
808 disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
809 if (! items.isEmpty()) {
810 QTableWidgetItem *item;
813 if (items.size() == 1) {
815 row = myEnforcedTableWidget->row(item);
816 QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
817 QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
818 QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
819 QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
820 entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
821 if (!entry.isNull()) {
822 SMESH::string_array_var objIds = new SMESH::string_array;
824 objIds[0] = entry.toString().toStdString().c_str();
825 myEnfVertexWdg->SetObjects(objIds);
828 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
830 QVariant group = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole);
831 if (!x.isNull()/* && entry.isNull()*/) {
832 // disconnect( myXCoord, SIGNAL( textChanged(const QString &)), this, SLOT( onSelectEnforcedVertex() ) );
833 disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
834 disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
835 disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
836 myXCoord->SetValue(x.toDouble());
837 myYCoord->SetValue(y.toDouble());
838 myZCoord->SetValue(z.toDouble());
839 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
840 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
841 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
844 mySizeValue->SetValue(size.toDouble());
846 if (!group.isNull() && (!x.isNull() || !entry.isNull()))
847 myGroupName->setText(group.toString());
850 QList<QString> entryList;
851 for (int i = 0; i < items.size(); ++i) {
853 row = myEnforcedTableWidget->row(item);
854 entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
856 entryList << entry.toString();
858 if (entryList.size() > 0) {
859 SMESH::string_array_var objIds = new SMESH::string_array;
860 objIds->length(entryList.size());
861 for (int i = 0; i < entryList.size() ; i++)
862 objIds[i] = entryList.at(i).toStdString().c_str();
863 myEnfVertexWdg->SetObjects(objIds);
866 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
871 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
873 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
874 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
875 that->checkVertexIsDefined();
878 /** GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh( meshName, geomEntry, elemType, size, groupName)
879 This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
881 void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
883 MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
884 bool okToCreate = true;
885 QString itemEntry = "";
886 int itemElementType = 0;
887 int rowCount = myEnforcedMeshTableWidget->rowCount();
888 bool allColumns = true;
889 for (int row = 0;row<rowCount;row++) {
890 for (int col = 0 ; col < ENF_MESH_NB_COLUMNS ; col++) {
891 MESSAGE("col: " << col);
892 if (col == ENF_MESH_CONSTRAINT_COLUMN){
893 if (qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col)) == 0) {
895 MESSAGE("allColumns = false");
899 else if (myEnforcedMeshTableWidget->item(row, col) == 0) {
901 MESSAGE("allColumns = false");
904 if (col == ENF_MESH_CONSTRAINT_COLUMN) {
905 QComboBox* itemComboBox = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col));
906 itemElementType = itemComboBox->currentIndex();
907 MESSAGE("itemElementType: " << itemElementType);
909 else if (col == ENF_MESH_ENTRY_COLUMN)
910 itemEntry = myEnforcedMeshTableWidget->item(row, col)->data(Qt::EditRole).toString();
916 if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) {
917 // // update group name
918 // if (itemGroupName.toStdString() != groupName) {
919 // MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
920 // myEnforcedMeshTableWidget->item(row, ENF_MESH_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
931 MESSAGE("Creation of enforced mesh");
933 myEnforcedMeshTableWidget->setRowCount(rowCount+1);
934 myEnforcedMeshTableWidget->setSortingEnabled(false);
936 for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
937 MESSAGE("Column: " << col);
938 if (col == ENF_MESH_CONSTRAINT_COLUMN) {
939 QComboBox* comboBox = new QComboBox();
940 QPalette pal = comboBox->palette();
941 pal.setColor(QPalette::Button, Qt::white);
942 comboBox->setPalette(pal);
943 comboBox->insertItems(0,myEnfMeshConstraintLabels);
944 comboBox->setEditable(false);
945 comboBox->setCurrentIndex(elementType);
946 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
947 myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
950 QTableWidgetItem* item = new QTableWidgetItem();
951 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
953 case ENF_MESH_NAME_COLUMN:
954 item->setData( 0, name.c_str() );
955 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
956 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
957 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
959 case ENF_MESH_ENTRY_COLUMN:
960 item->setData( 0, entry.c_str() );
961 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
962 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
963 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
965 case ENF_MESH_GROUP_COLUMN:
966 item->setData( 0, groupName.c_str() );
967 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
968 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
977 // connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
979 myEnforcedMeshTableWidget->setSortingEnabled(true);
980 // myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
981 // updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
985 /** GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex( x, y, z, size, vertexName, geomEntry, groupName)
986 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.
988 void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, double size, std::string vertexName, std::string geomEntry, std::string groupName, bool isCompound)
990 MESSAGE("addEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ", \"" << vertexName << ", \"" << geomEntry << "\", \"" << groupName << "\", " << isCompound << ")");
991 myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
992 bool okToCreate = true;
993 double itemX,itemY,itemZ,itemSize = 0;
994 QString itemEntry, itemGroupName = QString("");
995 // bool itemIsCompound;
996 int rowCount = myEnforcedTableWidget->rowCount();
999 for (int row = 0;row<rowCount;row++) {
1001 for (int col = 0 ; col < ENF_VER_NB_COLUMNS ; col++) {
1002 if (myEnforcedTableWidget->item(row, col) == 0) {
1007 data = myEnforcedTableWidget->item(row, col)->data(Qt::EditRole);
1008 if (!data.isNull()) {
1010 case ENF_VER_GROUP_COLUMN:
1011 itemGroupName = data.toString();
1013 case ENF_VER_ENTRY_COLUMN:
1014 itemEntry = data.toString();
1016 // case ENF_VER_COMPOUND_COLUMN:
1017 // itemIsCompound = data.toBool();
1019 case ENF_VER_X_COLUMN:
1020 itemX = data.toDouble();
1022 case ENF_VER_Y_COLUMN:
1023 itemY = data.toDouble();
1025 case ENF_VER_Z_COLUMN:
1026 itemZ = data.toDouble();
1028 case ENF_VER_SIZE_COLUMN:
1029 itemSize = data.toDouble();
1041 if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) {
1043 if (itemSize != size) {
1044 MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
1045 myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
1047 // update group name
1048 if (itemGroupName.toStdString() != groupName) {
1049 MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
1050 myEnforcedTableWidget->item(row, ENF_VER_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
1057 if (geomEntry.empty()) {
1058 MESSAGE("Vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
1061 MESSAGE("Vertex with entry " << geomEntry << " already exist: dont create again");
1066 if (geomEntry.empty()) {
1067 MESSAGE("Vertex with coords " << x << ", " << y << ", " << z<< " is created");
1070 MESSAGE("Vertex with geom entry " << geomEntry << " is created");
1075 QString myVertexName;
1076 while(indexRef != vertexIndex) {
1077 indexRef = vertexIndex;
1078 if (vertexName.empty())
1079 myVertexName = QString("Vertex #%1").arg(vertexIndex);
1081 myVertexName = QString(vertexName.c_str());
1083 for (int row = 0;row<rowCount;row++) {
1084 QString name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString();
1085 if (myVertexName == name) {
1092 MESSAGE("myVertexName is \"" << myVertexName.toStdString() << "\"");
1093 myEnforcedTableWidget->setRowCount(rowCount+1);
1094 myEnforcedTableWidget->setSortingEnabled(false);
1095 for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
1096 MESSAGE("Column: " << col);
1097 QTableWidgetItem* item = new QTableWidgetItem();
1098 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1100 case ENF_VER_NAME_COLUMN:
1101 item->setData( Qt::EditRole, myVertexName );
1102 if (!geomEntry.empty()) {
1104 item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1106 item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1109 case ENF_VER_X_COLUMN:
1111 item->setData( 0, QVariant(x) );
1113 case ENF_VER_Y_COLUMN:
1115 item->setData( 0, QVariant(y) );
1117 case ENF_VER_Z_COLUMN:
1119 item->setData( 0, QVariant(z) );
1121 case ENF_VER_SIZE_COLUMN:
1122 item->setData( 0, QVariant(size) );
1124 case ENF_VER_ENTRY_COLUMN:
1125 if (!geomEntry.empty())
1126 item->setData( 0, QString(geomEntry.c_str()) );
1128 case ENF_VER_COMPOUND_COLUMN:
1129 item->setData( Qt::CheckStateRole, isCompound );
1130 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
1132 case ENF_VER_GROUP_COLUMN:
1133 if (!groupName.empty())
1134 item->setData( 0, QString(groupName.c_str()) );
1140 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1141 myEnforcedTableWidget->setItem(rowCount,col,item);
1145 connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1147 myEnforcedTableWidget->setSortingEnabled(true);
1148 // myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1149 updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1152 /** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
1153 This method is called when a item is added into the enforced meshes tree widget
1155 void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
1157 MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()");
1159 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
1161 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1162 myEnfMeshWdg->deactivateSelection();
1164 for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
1165 myEnforcedMeshTableWidget->resizeColumnToContents(column);
1168 int selEnfMeshes = myEnfMeshWdg->NbObjects();
1169 if (selEnfMeshes == 0)
1172 std::string groupName = myMeshGroupName->text().toStdString();
1173 // if (myGlobalGroupName->isChecked())
1174 // groupName = myGlobalGroupName->text().toStdString();
1176 if (boost::trim_copy(groupName).empty())
1180 int elementType = myEnfMeshConstraint->currentIndex();
1183 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1184 _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
1185 QString meshEntry = myEnfMeshWdg->GetValue();
1186 MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
1188 if (selEnfMeshes == 1)
1190 MESSAGE("1 SMESH object selected");
1191 // myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
1192 // std::string entry = myEnfMeshWdg->GetValue();
1193 aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
1194 CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
1195 if (!CORBA::is_nil(anObj)) {
1196 // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
1197 addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
1202 MESSAGE(selEnfMeshes << " SMESH objects selected");
1203 QStringList meshEntries = meshEntry.split(" ", QString::SkipEmptyParts);
1204 QStringListIterator meshEntriesIt (meshEntries);
1205 while (meshEntriesIt.hasNext()) {
1206 aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
1207 CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
1208 if (!CORBA::is_nil(anObj)) {
1209 // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
1210 addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
1215 myEnfVertexWdg->SetObject(SMESH::SMESH_IDSource::_nil());
1217 for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
1218 myEnforcedMeshTableWidget->resizeColumnToContents(column);
1222 /** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
1223 This method is called when a item is added into the enforced vertices tree widget
1225 void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
1227 MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()");
1229 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
1231 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1232 myEnfVertexWdg->deactivateSelection();
1234 for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
1235 myEnforcedTableWidget->resizeColumnToContents(column);
1238 int selEnfVertex = myEnfVertexWdg->NbObjects();
1239 bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
1240 if ((selEnfVertex == 0) && coordsEmpty)
1243 std::string groupName = myGroupName->text().toStdString();
1244 // if (myGlobalGroupName->isChecked())
1245 // groupName = myGlobalGroupName->text().toStdString();
1247 if (boost::trim_copy(groupName).empty())
1250 double size = mySizeValue->GetValue();
1252 if (selEnfVertex <= 1)
1254 MESSAGE("0 or 1 GEOM object selected");
1255 double x = 0, y = 0, z=0;
1256 if (myXCoord->GetString() != "") {
1257 x = myXCoord->GetValue();
1258 y = myYCoord->GetValue();
1259 z = myZCoord->GetValue();
1261 if (selEnfVertex == 1) {
1262 MESSAGE("1 GEOM object selected");
1263 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
1264 std::string entry = "";
1265 if (myEnfVertex != GEOM::GEOM_Object::_nil())
1266 entry = myEnfVertex->GetStudyEntry();
1267 addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),entry, groupName, myEnfVertex->GetShapeType() == GEOM::COMPOUND);
1270 MESSAGE("0 GEOM object selected");
1271 MESSAGE("Coords: ("<<x<<","<<y<<","<<z<<")");
1272 addEnforcedVertex(x, y, z, size, "", "", groupName);
1277 if ( CORBA::is_nil(getGeomEngine()))
1280 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
1281 if (CORBA::is_nil(measureOp))
1284 CORBA::Double x = 0, y = 0,z = 0;
1285 for (int j = 0 ; j < selEnfVertex ; j++)
1287 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(j);
1288 if (myEnfVertex == GEOM::GEOM_Object::_nil())
1290 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
1291 measureOp->PointCoordinates (myEnfVertex, x, y, z);
1292 if ( measureOp->IsDone() )
1293 addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
1294 } else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
1295 addEnforcedVertex(0., 0., 0., size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName, true);
1300 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
1302 for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
1303 myEnforcedTableWidget->resizeColumnToContents(column);
1306 /** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
1307 This method is called when a item is removed from the enforced meshes tree widget
1309 void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
1311 QList<int> selectedRows;
1312 QList<QTableWidgetItem *> selectedItems = myEnforcedMeshTableWidget->selectedItems();
1313 QTableWidgetItem* item;
1315 foreach( item, selectedItems ) {
1317 if (!selectedRows.contains( row ) )
1318 selectedRows.append(row);
1321 qSort( selectedRows );
1322 QListIterator<int> it( selectedRows );
1324 while ( it.hasPrevious() ) {
1325 row = it.previous();
1326 MESSAGE("delete row #"<< row);
1327 myEnforcedMeshTableWidget->removeRow(row );
1330 myEnforcedMeshTableWidget->selectionModel()->clearSelection();
1333 /** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
1334 This method is called when a item is removed from the enforced vertices tree widget
1336 void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
1338 QList<int> selectedRows;
1339 QList<QTableWidgetItem *> selectedItems = myEnforcedTableWidget->selectedItems();
1340 QTableWidgetItem* item;
1342 foreach( item, selectedItems ) {
1344 if (!selectedRows.contains( row ) )
1345 selectedRows.append(row);
1348 qSort( selectedRows );
1349 QListIterator<int> it( selectedRows );
1351 while ( it.hasPrevious() ) {
1352 row = it.previous();
1353 MESSAGE("delete row #"<< row);
1354 myEnforcedTableWidget->removeRow(row );
1357 myEnforcedTableWidget->selectionModel()->clearSelection();
1360 void GHS3DPluginGUI_HypothesisCreator::onToMeshHoles(bool isOn)
1362 // myToMakeGroupsOfDomains->setEnabled( isOn );
1364 // myToMakeGroupsOfDomains->setChecked( false );
1367 void GHS3DPluginGUI_HypothesisCreator::onDirBtnClicked()
1369 QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myAdvWidget->workingDirectoryLineEdit->text(), QString() );
1370 if ( !dir.isEmpty() )
1371 myAdvWidget->workingDirectoryLineEdit->setText( dir );
1374 void GHS3DPluginGUI_HypothesisCreator::updateWidgets()
1376 //myToMakeGroupsOfDomains->setEnabled( myToMeshHolesCheck->isChecked() );
1377 myAdvWidget->maxMemorySpin->setEnabled( myAdvWidget->maxMemoryCheck->isChecked() );
1378 myAdvWidget->initialMemoryCheck->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
1379 myAdvWidget->initialMemorySpin->setEnabled( myAdvWidget->initialMemoryCheck->isChecked() && !myAdvWidget->boundaryRecoveryCheck->isChecked() );
1380 myOptimizationLevelCombo->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
1381 if ( sender() == myAdvWidget->logInFileCheck ||
1382 sender() == myAdvWidget->keepWorkingFilesCheck )
1384 bool logFileRemovable = myAdvWidget->logInFileCheck->isChecked() &&
1385 !myAdvWidget->keepWorkingFilesCheck->isChecked();
1387 myAdvWidget->removeLogOnSuccessCheck->setEnabled( logFileRemovable );
1391 bool GHS3DPluginGUI_HypothesisCreator::checkParams(QString& msg) const
1393 MESSAGE("GHS3DPluginGUI_HypothesisCreator::checkParams");
1395 if ( !QFileInfo( myAdvWidget->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
1396 SUIT_MessageBox::warning( dlg(),
1397 tr( "SMESH_WRN_WARNING" ),
1398 tr( "GHS3D_PERMISSION_DENIED" ) );
1405 void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
1407 MESSAGE("GHS3DPluginGUI_HypothesisCreator::retrieveParams");
1408 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
1409 GHS3DHypothesisData data;
1410 readParamsFromHypo( data );
1413 myName->setText( data.myName );
1415 myToMeshHolesCheck ->setChecked ( data.myToMeshHoles );
1416 myToMakeGroupsOfDomains ->setChecked ( data.myToMakeGroupsOfDomains );
1417 myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
1418 myAdvWidget->maxMemoryCheck ->setChecked ( data.myMaximumMemory > 0 );
1419 myAdvWidget->maxMemorySpin ->setValue ( qMax( data.myMaximumMemory,
1420 myAdvWidget->maxMemorySpin->minimum() ));
1421 myAdvWidget->initialMemoryCheck ->setChecked ( data.myInitialMemory > 0 );
1422 myAdvWidget->initialMemorySpin ->setValue ( qMax( data.myInitialMemory,
1423 myAdvWidget->initialMemorySpin->minimum() ));
1424 myAdvWidget->workingDirectoryLineEdit ->setText ( data.myWorkingDir );
1425 myAdvWidget->keepWorkingFilesCheck ->setChecked ( data.myKeepFiles );
1426 myAdvWidget->verboseLevelSpin ->setValue ( data.myVerboseLevel );
1427 myAdvWidget->createNewNodesCheck ->setChecked ( data.myToCreateNewNodes );
1428 myAdvWidget->removeInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint );
1429 myAdvWidget->boundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery );
1430 myAdvWidget->FEMCorrectionCheck ->setChecked ( data.myFEMCorrection );
1431 myAdvWidget->gradationSpinBox ->setValue ( data.myGradation );
1432 myAdvWidget->textOptionLineEdit ->setText ( data.myTextOption );
1433 myAdvWidget->logInFileCheck ->setChecked ( !data.myLogInStandardOutput );
1434 myAdvWidget->removeLogOnSuccessCheck ->setChecked ( data.myRemoveLogOnSuccess );
1436 TEnfVertexList::const_iterator it;
1438 myEnforcedTableWidget->clearContents();
1439 myEnforcedTableWidget->setSortingEnabled(false);
1440 myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
1441 for(it = data.myEnforcedVertices.begin() ; it != data.myEnforcedVertices.end(); it++ )
1443 TEnfVertex* enfVertex = (*it);
1444 myEnforcedTableWidget->setRowCount(rowCount+1);
1446 for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
1447 MESSAGE("Column: " << col);
1448 // MESSAGE("enfVertex->isCompound: " << enfVertex->isCompound);
1449 QTableWidgetItem* item = new QTableWidgetItem();
1450 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1452 case ENF_VER_NAME_COLUMN:
1453 item->setData( 0, enfVertex->name.c_str() );
1454 if (!enfVertex->geomEntry.empty()) {
1455 if (enfVertex->isCompound)
1456 item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1458 item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1460 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1463 case ENF_VER_X_COLUMN:
1464 if (!enfVertex->isCompound) {
1465 item->setData( 0, enfVertex->coords.at(0) );
1466 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1469 case ENF_VER_Y_COLUMN:
1470 if (!enfVertex->isCompound) {
1471 item->setData( 0, enfVertex->coords.at(1) );
1472 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1475 case ENF_VER_Z_COLUMN:
1476 if (!enfVertex->isCompound) {
1477 item->setData( 0, enfVertex->coords.at(2) );
1478 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1481 case ENF_VER_SIZE_COLUMN:
1482 item->setData( 0, enfVertex->size );
1483 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1485 case ENF_VER_ENTRY_COLUMN:
1486 item->setData( 0, enfVertex->geomEntry.c_str() );
1487 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1489 case ENF_VER_COMPOUND_COLUMN:
1490 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
1491 item->setData( Qt::CheckStateRole, enfVertex->isCompound );
1492 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << enfVertex->isCompound);
1494 case ENF_VER_GROUP_COLUMN:
1495 item->setData( 0, enfVertex->groupName.c_str() );
1496 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1502 myEnforcedTableWidget->setItem(rowCount,col,item);
1505 that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1509 connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1510 myEnforcedTableWidget->setSortingEnabled(true);
1512 for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
1513 myEnforcedTableWidget->resizeColumnToContents(column);
1515 // Update Enforced meshes QTableWidget
1516 TEnfMeshList::const_iterator itMesh;
1518 myEnforcedMeshTableWidget->clearContents();
1519 myEnforcedMeshTableWidget->setSortingEnabled(false);
1520 // myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
1521 for(itMesh = data.myEnforcedMeshes.begin() ; itMesh != data.myEnforcedMeshes.end(); itMesh++ )
1523 TEnfMesh* enfMesh = (*itMesh);
1524 myEnforcedMeshTableWidget->setRowCount(rowCount+1);
1526 for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
1527 MESSAGE("Column: " << col);
1528 if (col == ENF_MESH_CONSTRAINT_COLUMN) {
1529 QComboBox* comboBox = new QComboBox();
1530 QPalette pal = comboBox->palette();
1531 pal.setColor(QPalette::Button, Qt::white);
1532 comboBox->setPalette(pal);
1533 comboBox->insertItems(0,myEnfMeshConstraintLabels);
1534 comboBox->setEditable(false);
1535 comboBox->setCurrentIndex(enfMesh->elementType);
1536 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
1537 myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
1540 QTableWidgetItem* item = new QTableWidgetItem();
1541 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1543 case ENF_MESH_NAME_COLUMN:
1544 item->setData( 0, enfMesh->name.c_str() );
1545 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
1546 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1547 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1549 case ENF_MESH_ENTRY_COLUMN:
1550 item->setData( 0, enfMesh->entry.c_str() );
1551 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
1552 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1553 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1555 case ENF_MESH_GROUP_COLUMN:
1556 item->setData( 0, enfMesh->groupName.c_str() );
1557 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1558 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1565 // myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1568 // that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1572 // connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1573 myEnforcedMeshTableWidget->setSortingEnabled(true);
1575 for (int col=0;col<ENF_MESH_NB_COLUMNS;col++)
1576 myEnforcedMeshTableWidget->resizeColumnToContents(col);
1578 that->updateWidgets();
1579 that->checkVertexIsDefined();
1582 QString GHS3DPluginGUI_HypothesisCreator::storeParams() const
1584 MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParams");
1585 GHS3DHypothesisData data;
1586 readParamsFromWidgets( data );
1587 storeParamsToHypo( data );
1589 QString valStr = "";
1591 if ( !data.myBoundaryRecovery )
1592 valStr = "-c " + QString::number( !data.myToMeshHoles );
1594 if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
1595 const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
1597 valStr += level[ data.myOptimizationLevel ];
1599 if ( data.myMaximumMemory > 0 ) {
1601 valStr += QString::number( data.myMaximumMemory );
1603 if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
1605 valStr += QString::number( data.myInitialMemory );
1608 valStr += QString::number( data.myVerboseLevel );
1610 if ( !data.myToCreateNewNodes )
1613 if ( data.myRemoveInitialCentralPoint )
1614 valStr += " -no_initial_central_point";
1616 if ( data.myBoundaryRecovery )
1619 if ( data.myFEMCorrection )
1622 if ( data.myGradation != 1.05 ) {
1623 valStr += " -Dcpropa=";
1624 valStr += QString::number( data.myGradation );
1628 valStr += data.myTextOption;
1630 // valStr += " #BEGIN ENFORCED VERTICES#";
1631 // // Add size map parameters storage
1632 // for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
1634 // double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
1635 // double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
1636 // double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
1637 // double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
1638 // valStr += QString::number( x );
1640 // valStr += QString::number( y );
1642 // valStr += QString::number( z );
1644 // valStr += QString::number( size );
1645 // if (i!=mySmpModel->rowCount()-1)
1648 // valStr += " #END ENFORCED VERTICES#";
1649 // MESSAGE(valStr.toStdString());
1653 bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data ) const
1655 MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo");
1656 GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
1657 GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( initParamsHypothesis() );
1659 HypothesisData* data = SMESH::GetHypothesisData( hypType() );
1660 h_data.myName = isCreation() && data ? hypName() : "";
1662 h_data.myToMeshHoles = h->GetToMeshHoles();
1663 h_data.myToMakeGroupsOfDomains = /*h->GetToMeshHoles() &&*/ h->GetToMakeGroupsOfDomains();
1664 h_data.myMaximumMemory = h->GetMaximumMemory();
1665 h_data.myInitialMemory = h->GetInitialMemory();
1666 h_data.myInitialMemory = h->GetInitialMemory();
1667 h_data.myOptimizationLevel = h->GetOptimizationLevel();
1668 h_data.myKeepFiles = h->GetKeepFiles();
1669 h_data.myWorkingDir = h->GetWorkingDirectory();
1670 h_data.myVerboseLevel = h->GetVerboseLevel();
1671 h_data.myToCreateNewNodes = h->GetToCreateNewNodes();
1672 h_data.myRemoveInitialCentralPoint = h->GetToRemoveCentralPoint();
1673 h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion();
1674 h_data.myFEMCorrection = h->GetFEMCorrection();
1675 h_data.myGradation = h->GetGradation();
1676 h_data.myTextOption = h->GetTextOption();
1677 h_data.myLogInStandardOutput = h->GetStandardOutputLog();
1678 h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess();
1680 GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
1681 MESSAGE("vertices->length(): " << vertices->length());
1682 h_data.myEnforcedVertices.clear();
1683 for (int i=0 ; i<vertices->length() ; i++) {
1684 TEnfVertex* myVertex = new TEnfVertex();
1685 myVertex->name = CORBA::string_dup(vertices[i].name.in());
1686 myVertex->geomEntry = CORBA::string_dup(vertices[i].geomEntry.in());
1687 myVertex->groupName = CORBA::string_dup(vertices[i].groupName.in());
1688 myVertex->size = vertices[i].size;
1689 myVertex->isCompound = vertices[i].isCompound;
1690 if (vertices[i].coords.length()) {
1691 for (int c = 0; c < vertices[i].coords.length() ; c++)
1692 myVertex->coords.push_back(vertices[i].coords[c]);
1693 MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
1695 h_data.myEnforcedVertices.insert(myVertex);
1698 GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
1699 MESSAGE("enfMeshes->length(): " << enfMeshes->length());
1700 h_data.myEnforcedMeshes.clear();
1701 for (int i=0 ; i<enfMeshes->length() ; i++) {
1702 TEnfMesh* myEnfMesh = new TEnfMesh();
1703 myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
1704 myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
1705 myEnfMesh->groupName = CORBA::string_dup(enfMeshes[i].groupName.in());
1706 switch (enfMeshes[i].elementType) {
1708 myEnfMesh->elementType = 0;
1711 myEnfMesh->elementType = 1;
1714 myEnfMesh->elementType = 2;
1719 // myEnfMesh->elementType = enfMeshes[i].elementType;
1720 h_data.myEnforcedMeshes.insert(myEnfMesh);
1725 bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisData& h_data ) const
1727 MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo");
1728 GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
1729 GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( hypothesis() );
1735 SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
1737 if ( h->GetToMeshHoles() != h_data.myToMeshHoles ) // avoid duplication of DumpPython commands
1738 h->SetToMeshHoles ( h_data.myToMeshHoles );
1739 if ( h->GetToMakeGroupsOfDomains() != h_data.myToMakeGroupsOfDomains )
1740 h->SetToMakeGroupsOfDomains( h_data.myToMakeGroupsOfDomains );
1741 if ( h->GetMaximumMemory() != h_data.myMaximumMemory )
1742 h->SetMaximumMemory ( h_data.myMaximumMemory );
1743 if ( h->GetInitialMemory() != h_data.myInitialMemory )
1744 h->SetInitialMemory ( h_data.myInitialMemory );
1745 if ( h->GetInitialMemory() != h_data.myInitialMemory )
1746 h->SetInitialMemory ( h_data.myInitialMemory );
1747 if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel )
1748 h->SetOptimizationLevel( h_data.myOptimizationLevel );
1749 if ( h->GetKeepFiles() != h_data.myKeepFiles )
1750 h->SetKeepFiles ( h_data.myKeepFiles );
1751 if ( h->GetWorkingDirectory() != h_data.myWorkingDir )
1752 h->SetWorkingDirectory ( h_data.myWorkingDir.toLatin1().constData() );
1753 if ( h->GetVerboseLevel() != h_data.myVerboseLevel )
1754 h->SetVerboseLevel ( h_data.myVerboseLevel );
1755 if ( h->GetToCreateNewNodes() != h_data.myToCreateNewNodes )
1756 h->SetToCreateNewNodes( h_data.myToCreateNewNodes );
1757 if ( h->GetToRemoveCentralPoint() != h_data.myRemoveInitialCentralPoint )
1758 h->SetToRemoveCentralPoint( h_data.myRemoveInitialCentralPoint );
1759 if ( h->GetToUseBoundaryRecoveryVersion() != h_data.myBoundaryRecovery )
1760 h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery );
1761 if ( h->GetFEMCorrection() != h_data.myFEMCorrection )
1762 h->SetFEMCorrection ( h_data.myFEMCorrection );
1763 if ( h->GetGradation() != h_data.myGradation )
1764 h->SetGradation ( h_data.myGradation );
1765 if ( h->GetTextOption() != h_data.myTextOption )
1766 h->SetTextOption ( h_data.myTextOption.toLatin1().constData() );
1767 if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput )
1768 h->SetStandardOutputLog( h_data.myLogInStandardOutput );
1769 if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
1770 h->SetRemoveLogOnSuccess( h_data.myRemoveLogOnSuccess );
1772 // Enforced vertices
1773 int nbVertex = (int) h_data.myEnforcedVertices.size();
1774 GHS3DPlugin::GHS3DEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices();
1775 int nbVertexHyp = vertexHyp->length();
1777 MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices");
1778 MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp);
1780 // 1. Clear all enforced vertices in hypothesis
1781 // 2. Add new enforced vertex according to h_data
1782 if ( nbVertexHyp > 0)
1783 h->ClearEnforcedVertices();
1785 TEnfVertexList::const_iterator it;
1786 double x = 0, y = 0, z = 0;
1787 for(it = h_data.myEnforcedVertices.begin() ; it != h_data.myEnforcedVertices.end(); it++ ) {
1788 TEnfVertex* enfVertex = (*it);
1790 if (enfVertex->coords.size()) {
1791 x = enfVertex->coords.at(0);
1792 y = enfVertex->coords.at(1);
1793 z = enfVertex->coords.at(2);
1795 ok = h->p_SetEnforcedVertex( enfVertex->size, x, y, z, enfVertex->name.c_str(), enfVertex->geomEntry.c_str(), enfVertex->groupName.c_str(), enfVertex->isCompound);
1799 int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
1800 GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshListHyp = h->GetEnforcedMeshes();
1801 int nbEnfMeshListHyp = enfMeshListHyp->length();
1803 MESSAGE("Store params for size maps: " << nbEnfMeshes << " enforced meshes");
1804 MESSAGE("h->GetEnforcedMeshes()->length(): " << nbEnfMeshListHyp);
1806 // 1. Clear all enforced vertices in hypothesis
1807 // 2. Add new enforced vertex according to h_data
1808 if ( nbEnfMeshListHyp > 0)
1809 h->ClearEnforcedMeshes();
1811 TEnfMeshList::const_iterator itEnfMesh;
1813 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1815 for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
1816 TEnfMesh* enfMesh = (*itEnfMesh);
1818 _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
1819 SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
1821 MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
1822 SMESH::ElementType elementType;
1823 switch(enfMesh->elementType) {
1825 elementType = SMESH::NODE;
1828 elementType = SMESH::EDGE;
1831 elementType = SMESH::FACE;
1837 std::cout << "h->p_SetEnforcedMesh(theSource, "<< elementType <<", \""<< enfMesh->name << "\", \"" << enfMesh->groupName.c_str() <<"\")"<<std::endl;
1838 ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str());
1841 // catch(const std::exception& ex) {
1842 // std::cout << "Exception: " << ex.what() << std::endl;
1845 catch ( const SALOME::SALOME_Exception& ex )
1847 SalomeApp_Tools::QtCatchCorbaException( ex );
1853 bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisData& h_data ) const
1855 MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets");
1856 h_data.myName = myName ? myName->text() : "";
1857 h_data.myToMeshHoles = myToMeshHolesCheck->isChecked();
1858 h_data.myToMakeGroupsOfDomains = myToMakeGroupsOfDomains->isChecked();
1859 h_data.myMaximumMemory = myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1;
1860 h_data.myInitialMemory = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1;
1861 h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex();
1862 h_data.myKeepFiles = myAdvWidget->keepWorkingFilesCheck->isChecked();
1863 h_data.myWorkingDir = myAdvWidget->workingDirectoryLineEdit->text().trimmed();
1864 h_data.myVerboseLevel = myAdvWidget->verboseLevelSpin->value();
1865 h_data.myToCreateNewNodes = myAdvWidget->createNewNodesCheck->isChecked();
1866 h_data.myRemoveInitialCentralPoint = myAdvWidget->removeInitialCentralPointCheck->isChecked();
1867 h_data.myBoundaryRecovery = myAdvWidget->boundaryRecoveryCheck->isChecked();
1868 h_data.myFEMCorrection = myAdvWidget->FEMCorrectionCheck->isChecked();
1869 h_data.myGradation = myAdvWidget->gradationSpinBox->value();
1870 h_data.myTextOption = myAdvWidget->textOptionLineEdit->text();
1871 h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked();
1872 h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked();
1874 // Enforced vertices
1875 h_data.myEnforcedVertices.clear();
1876 QVariant valueX, valueY, valueZ;
1877 for (int row=0 ; row<myEnforcedTableWidget->rowCount() ; row++) {
1879 TEnfVertex *myVertex = new TEnfVertex();
1880 myVertex->name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
1881 MESSAGE("Add new enforced vertex \"" << myVertex->name << "\"" );
1882 myVertex->geomEntry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
1883 if (myVertex->geomEntry.size())
1884 MESSAGE("Geom entry is \"" << myVertex->geomEntry << "\"" );
1885 myVertex->groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
1886 if (myVertex->groupName.size())
1887 MESSAGE("Group name is \"" << myVertex->groupName << "\"" );
1888 valueX = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data(Qt::EditRole);
1889 valueY = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data(Qt::EditRole);
1890 valueZ = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data(Qt::EditRole);
1891 if (!valueX.isNull() && !valueY.isNull() && !valueZ.isNull()) {
1892 myVertex->coords.push_back(valueX.toDouble());
1893 myVertex->coords.push_back(valueY.toDouble());
1894 myVertex->coords.push_back(valueZ.toDouble());
1895 MESSAGE("Coords are (" << myVertex->coords.at(0) << ", "
1896 << myVertex->coords.at(1) << ", "
1897 << myVertex->coords.at(2) << ")");
1899 myVertex->size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
1900 MESSAGE("Size is " << myVertex->size);
1901 myVertex->isCompound = myEnforcedTableWidget->item(row,ENF_VER_COMPOUND_COLUMN)->data(Qt::CheckStateRole).toBool();
1902 MESSAGE("Is compound ? " << myVertex->isCompound);
1903 h_data.myEnforcedVertices.insert(myVertex);
1907 h_data.myEnforcedMeshes.clear();
1909 for (int row=0 ; row<myEnforcedMeshTableWidget->rowCount() ; row++) {
1911 TEnfMesh *myEnfMesh = new TEnfMesh();
1912 myEnfMesh->name = myEnforcedMeshTableWidget->item(row,ENF_MESH_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
1913 MESSAGE("Add new enforced mesh \"" << myEnfMesh->name << "\"" );
1914 myEnfMesh->entry = myEnforcedMeshTableWidget->item(row,ENF_MESH_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
1915 MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
1916 myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
1917 MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
1918 QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
1919 myEnfMesh->elementType = combo->currentIndex();
1920 MESSAGE("Element type: " << myEnfMesh->elementType);
1921 h_data.myEnforcedMeshes.insert(myEnfMesh);
1922 std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
1928 QString GHS3DPluginGUI_HypothesisCreator::caption() const
1930 return tr( "GHS3D_TITLE" );
1933 QPixmap GHS3DPluginGUI_HypothesisCreator::icon() const
1935 return SUIT_Session::session()->resourceMgr()->loadPixmap( "GHS3DPlugin", tr( "ICON_DLG_GHS3D_PARAMETERS" ) );
1938 QString GHS3DPluginGUI_HypothesisCreator::type() const
1940 return tr( "GHS3D_HYPOTHESIS" );
1943 QString GHS3DPluginGUI_HypothesisCreator::helpPage() const
1945 return "ghs3d_hypo_page.html";