1 // Copyright (C) 2004-2012 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
26 #include "GHS3DPluginGUI_HypothesisCreator.h"
27 // #include "GHS3DPluginGUI_EnforcedDelegates.h"
28 #include "GHS3DPluginGUI_Enums.h"
30 #include "GeometryGUI.h"
32 #include <SMESHGUI_Utils.h>
33 #include <SMESHGUI_SpinBox.h>
34 #include <SMESHGUI_HypothesesUtils.h>
35 #include <SMESH_NumberFilter.hxx>
36 #include <SMESH_TypeFilter.hxx>
37 #include <StdMeshersGUI_ObjectReferenceParamWdg.h>
39 #include <LightApp_SelectionMgr.h>
40 #include <SUIT_Session.h>
41 #include <SUIT_MessageBox.h>
42 #include <SUIT_ResourceMgr.h>
43 #include <SUIT_FileDlg.h>
44 #include <SalomeApp_Tools.h>
45 #include <SalomeApp_TypeFilter.h>
47 #include <TopoDS_Iterator.hxx>
53 #include <QVBoxLayout>
54 #include <QGridLayout>
59 #include <QPushButton>
63 #include <QTableWidget>
64 #include <QTableWidgetItem>
65 #include <QHeaderView>
68 #include <utilities.h>
70 #include <boost/algorithm/string.hpp>
77 #include <sys/sysinfo.h>
80 int maxAvailableMemory()
83 // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
84 MEMORYSTATUSEX statex;
85 statex.dwLength = sizeof (statex);
86 int err = GlobalMemoryStatusEx (&statex);
89 statex.ullTotalPhys / 1024 / 1024 +
90 statex.ullTotalPageFile / 1024 / 1024 +
91 statex.ullTotalVirtual / 1024 / 1024;
92 return (int) ( 0.7 * totMB );
96 int err = sysinfo( &si );
99 si.totalram * si.mem_unit / 1024 / 1024 +
100 si.totalswap * si.mem_unit / 1024 / 1024 ;
101 return (int) ( 0.7 * totMB );
109 // BEGIN EnforcedVertexTableWidgetDelegate
112 EnforcedVertexTableWidgetDelegate::EnforcedVertexTableWidgetDelegate(QObject *parent)
113 : QItemDelegate(parent)
117 QWidget *EnforcedVertexTableWidgetDelegate::createEditor(QWidget *parent,
118 const QStyleOptionViewItem & option ,
119 const QModelIndex & index ) const
121 QModelIndex father = index.parent();
122 QString entry = father.child(index.row(), ENF_VER_ENTRY_COLUMN).data().toString();
124 if (index.column() == ENF_VER_X_COLUMN ||
125 index.column() == ENF_VER_Y_COLUMN ||
126 index.column() == ENF_VER_Z_COLUMN ||
127 index.column() == ENF_VER_SIZE_COLUMN) {
128 SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
129 if (index.column() == ENF_VER_SIZE_COLUMN)
130 editor->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
132 editor->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
133 editor->setReadOnly(!entry.isEmpty());
134 editor->setDisabled(!entry.isEmpty());
137 // else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
138 // QCheckBox *editor = new QCheckBox(parent);
139 // editor->setDisabled(!entry.isEmpty());
142 else if (index.column() == ENF_VER_GROUP_COLUMN ||
143 index.column() == ENF_VER_NAME_COLUMN) {
145 QLineEdit *editor = new QLineEdit(parent);
146 if (index.column() != ENF_VER_GROUP_COLUMN) {
147 editor->setReadOnly(!entry.isEmpty());
148 editor->setDisabled(!entry.isEmpty());
152 return QItemDelegate::createEditor(parent, option, index);
155 void EnforcedVertexTableWidgetDelegate::setEditorData(QWidget *editor,
156 const QModelIndex &index) const
158 if (index.column() == ENF_VER_X_COLUMN ||
159 index.column() == ENF_VER_Y_COLUMN ||
160 index.column() == ENF_VER_Z_COLUMN ||
161 index.column() == ENF_VER_SIZE_COLUMN)
163 SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
164 lineEdit->SetValue(index.data().toDouble());
166 else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
167 QCheckBox *checkBox = qobject_cast<QCheckBox*>(editor);
168 checkBox->setChecked(index.data().toBool());
171 QItemDelegate::setEditorData(editor, index);
175 void EnforcedVertexTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
176 const QModelIndex &index) const
178 QModelIndex parent = index.parent();
180 QString entry = parent.child(index.row(), ENF_VER_ENTRY_COLUMN).data().toString();
181 bool isCompound = parent.child(index.row(), ENF_VER_COMPOUND_COLUMN).data(Qt::CheckStateRole).toBool();
183 if (index.column() == ENF_VER_X_COLUMN ||
184 index.column() == ENF_VER_Y_COLUMN ||
185 index.column() == ENF_VER_Z_COLUMN) {
186 SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
187 if (!isCompound && !vertexExists(model, index, lineEdit->GetString()))
188 model->setData(index, lineEdit->GetValue(), Qt::EditRole);
190 else if (index.column() == ENF_VER_SIZE_COLUMN)
192 SMESHGUI_SpinBox *lineEdit = qobject_cast<SMESHGUI_SpinBox*>(editor);
193 const double newsize = lineEdit->GetValue();
195 model->setData(index, newsize, Qt::EditRole);
197 else if (index.column() == ENF_VER_NAME_COLUMN) {
198 QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
199 QString value = lineEdit->text();
200 if (entry.isEmpty() && !vertexExists(model, index, value))
201 model->setData(index, value, Qt::EditRole);
203 else if (index.column() == ENF_VER_ENTRY_COLUMN) {
204 QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
205 QString value = lineEdit->text();
206 if (! vertexExists(model, index, value))
207 model->setData(index, value, Qt::EditRole);
209 else if (index.column() == ENF_VER_COMPOUND_COLUMN) {
210 QCheckBox *checkBox = qobject_cast<QCheckBox*>(editor);
211 model->setData(index, checkBox->isChecked(), Qt::CheckStateRole);
214 QItemDelegate::setModelData(editor, model, index);
218 void EnforcedVertexTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
219 const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
221 editor->setGeometry(option.rect);
224 bool EnforcedVertexTableWidgetDelegate::vertexExists(QAbstractItemModel *model,
225 const QModelIndex &index,
229 QModelIndex parent = index.parent();
230 int row = index.row();
231 int col = index.column();
233 if (parent.isValid() && !value.isEmpty()) {
234 if (col == ENF_VER_X_COLUMN || col == ENF_VER_Y_COLUMN || col == ENF_VER_Z_COLUMN) {
236 if (col == ENF_VER_X_COLUMN) {
237 x = value.toDouble();
238 y = parent.child(row, ENF_VER_Y_COLUMN).data().toDouble();
239 z = parent.child(row, ENF_VER_Z_COLUMN).data().toDouble();
241 if (col == ENF_VER_Y_COLUMN) {
242 y = value.toDouble();
243 x = parent.child(row, ENF_VER_X_COLUMN).data().toDouble();
244 z = parent.child(row, ENF_VER_Z_COLUMN).data().toDouble();
246 if (col == ENF_VER_Z_COLUMN) {
247 z = value.toDouble();
248 x = parent.child(row, ENF_VER_X_COLUMN).data().toDouble();
249 y = parent.child(row, ENF_VER_Y_COLUMN).data().toDouble();
251 int nbChildren = model->rowCount(parent);
252 for (int i = 0 ; i < nbChildren ; i++) {
254 double childX = parent.child(i, ENF_VER_X_COLUMN).data().toDouble();
255 double childY = parent.child(i, ENF_VER_Y_COLUMN).data().toDouble();
256 double childZ = parent.child(i, ENF_VER_Z_COLUMN).data().toDouble();
257 if ((childX == x) && (childY == y) && (childZ == z)) {
264 else if (col == ENF_VER_NAME_COLUMN) {
265 QString name = parent.child(row, ENF_VER_NAME_COLUMN).data().toString();
275 // END EnforcedVertexTableWidgetDelegate
279 // BEGIN EnforcedMeshTableWidgetDelegate
282 EnforcedMeshTableWidgetDelegate::EnforcedMeshTableWidgetDelegate(QObject *parent)
283 : QItemDelegate(parent)
287 QWidget *EnforcedMeshTableWidgetDelegate::createEditor(QWidget *parent,
288 const QStyleOptionViewItem & option ,
289 const QModelIndex & index ) const
291 if (index.column() == ENF_MESH_SIZE_COLUMN) {
292 SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
293 editor->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
296 return QItemDelegate::createEditor(parent, option, index);
299 void EnforcedMeshTableWidgetDelegate::setEditorData(QWidget *editor,
300 const QModelIndex &index) const
302 if (index.column() == ENF_MESH_SIZE_COLUMN) {
303 SMESHGUI_SpinBox *spinBox = qobject_cast<SMESHGUI_SpinBox*>(editor);
304 spinBox->SetValue(index.data().toDouble());
307 QItemDelegate::setEditorData(editor, index);
310 void EnforcedMeshTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
311 const QModelIndex &index) const
313 if (index.column() == ENF_MESH_SIZE_COLUMN)
315 SMESHGUI_SpinBox *spinBox = qobject_cast<SMESHGUI_SpinBox*>(editor);
316 const double newsize = spinBox->GetValue();
318 model->setData(index, newsize, Qt::EditRole);
321 QItemDelegate::setModelData(editor, model, index);
325 void EnforcedMeshTableWidgetDelegate::updateEditorGeometry(QWidget *editor,
326 const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
328 editor->setGeometry(option.rect);
331 // bool EnforcedMeshTableWidgetDelegate::enfMeshExists(QAbstractItemModel *model,
332 // const QModelIndex &index,
333 // QString value) const
335 // bool exists = false;
336 // QModelIndex parent = index.parent();
337 // int row = index.row();
338 // int col = index.column();
343 // END EnforcedMeshTableWidgetDelegate
347 GHS3DPluginGUI_HypothesisCreator::GHS3DPluginGUI_HypothesisCreator( const QString& theHypType )
348 : SMESHGUI_GenericHypothesisCreator( theHypType )
350 GeomToolSelected = NULL;
351 GeomToolSelected = getGeomSelectionTool();
353 iconVertex = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
354 iconCompound = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_OBJBROWSER_COMPOUND")));
355 // mySelectionMgr = SMESH::GetSelectionMgr(SMESHGUI::GetSMESHGUI());
356 myEnfMeshConstraintLabels << tr( "GHS3D_ENF_MESH_CONSTRAINT_NODE" ) << tr( "GHS3D_ENF_MESH_CONSTRAINT_EDGE" ) << tr("GHS3D_ENF_MESH_CONSTRAINT_FACE");
359 GHS3DPluginGUI_HypothesisCreator::~GHS3DPluginGUI_HypothesisCreator()
361 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
362 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
363 myEnfMeshWdg->deactivateSelection();
367 * \brief {Get or create the geom selection tool for active study}
369 GeomSelectionTools* GHS3DPluginGUI_HypothesisCreator::getGeomSelectionTool()
371 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
372 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
373 if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
374 that->GeomToolSelected = new GeomSelectionTools(aStudy);
376 return that->GeomToolSelected;
379 GEOM::GEOM_Gen_var GHS3DPluginGUI_HypothesisCreator::getGeomEngine()
381 return GeometryGUI::GetGeomGen();
384 QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
386 QFrame* fr = new QFrame( 0 );
387 QVBoxLayout* lay = new QVBoxLayout( fr );
389 lay->setSpacing( 0 );
392 QTabWidget* tab = new QTabWidget( fr );
393 tab->setTabShape( QTabWidget::Rounded );
394 tab->setTabPosition( QTabWidget::North );
395 lay->addWidget( tab );
398 myStdGroup = new QWidget();
399 QGridLayout* aStdLayout = new QGridLayout( myStdGroup );
400 aStdLayout->setSpacing( 6 );
401 aStdLayout->setMargin( 11 );
407 aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), row, 0, 1, 1 );
408 myName = new QLineEdit( myStdGroup );
409 aStdLayout->addWidget( myName, row++, 1, 1, 1 );
412 myToMeshHolesCheck = new QCheckBox( tr( "GHS3D_TO_MESH_HOLES" ), myStdGroup );
413 aStdLayout->addWidget( myToMeshHolesCheck, row++, 0, 1, 2 );
415 aStdLayout->addWidget( new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), myStdGroup ), row, 0, 1, 1 );
416 myOptimizationLevelCombo = new QComboBox( myStdGroup );
417 aStdLayout->addWidget( myOptimizationLevelCombo, row++, 1, 1, 1 );
420 types << tr( "LEVEL_NONE" ) << tr( "LEVEL_LIGHT" ) << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STANDARDPLUS" ) << tr( "LEVEL_STRONG" );
421 myOptimizationLevelCombo->addItems( types );
423 aStdLayout->setRowStretch( row, 10 );
425 // advanced parameters
426 myAdvGroup = new QWidget();
427 QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup );
428 anAdvLayout->setSpacing( 6 );
429 anAdvLayout->setMargin( 11 );
431 myMaximumMemoryCheck = new QCheckBox( tr( "MAX_MEMORY_SIZE" ), myAdvGroup );
432 myMaximumMemorySpin = new QSpinBox( myAdvGroup );
433 myMaximumMemorySpin->setMinimum( 1 );
434 myMaximumMemorySpin->setMaximum( maxAvailableMemory() );
435 myMaximumMemorySpin->setSingleStep( 10 );
436 QLabel* aMegabyteLabel = new QLabel( tr( "MEGABYTE" ), myAdvGroup );
438 myInitialMemoryCheck = new QCheckBox( tr( "INIT_MEMORY_SIZE" ), myAdvGroup );
439 myInitialMemorySpin = new QSpinBox( myAdvGroup );
440 myInitialMemorySpin->setMinimum( 1 );
441 myInitialMemorySpin->setMaximum( maxAvailableMemory() );
442 myInitialMemorySpin->setSingleStep( 10 );
443 QLabel* aMegabyteLabel2 = new QLabel( tr( "MEGABYTE" ), myAdvGroup );
445 QLabel* aWorkinDirLabel = new QLabel( tr( "WORKING_DIR" ), myAdvGroup );
446 myWorkingDir = new QLineEdit( myAdvGroup );
447 //myWorkingDir->setReadOnly( true );
448 QPushButton* dirBtn = new QPushButton( tr( "SELECT_DIR" ), myAdvGroup );
449 dirBtn->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
451 myKeepFiles = new QCheckBox( tr( "KEEP_WORKING_FILES" ), myAdvGroup );
453 QLabel* aVerboseLevelLabel = new QLabel( tr( "VERBOSE_LEVEL" ), myAdvGroup );
454 myVerboseLevelSpin = new QSpinBox( myAdvGroup );
455 myVerboseLevelSpin->setMinimum( 0 );
456 myVerboseLevelSpin->setMaximum( 10 );
457 myVerboseLevelSpin->setSingleStep( 1 );
459 myToCreateNewNodesCheck = new QCheckBox( tr( "TO_ADD_NODES" ), myAdvGroup );
461 myRemoveInitialCentralPointCheck = new QCheckBox( tr( "NO_INITIAL_CENTRAL_POINT" ), myAdvGroup );
463 myBoundaryRecoveryCheck = new QCheckBox( tr( "RECOVERY_VERSION" ), myAdvGroup );
465 myFEMCorrectionCheck = new QCheckBox( tr( "FEM_CORRECTION" ), myAdvGroup );
467 QLabel* aTextOptionLabel = new QLabel( tr( "TEXT_OPTION" ), myAdvGroup );
468 myTextOption = new QLineEdit( myAdvGroup );
470 anAdvLayout->addWidget( myMaximumMemoryCheck, 0, 0, 1, 1 );
471 anAdvLayout->addWidget( myMaximumMemorySpin, 0, 1, 1, 1 );
472 anAdvLayout->addWidget( aMegabyteLabel, 0, 2, 1, 1 );
473 anAdvLayout->addWidget( myInitialMemoryCheck, 1, 0, 1, 1 );
474 anAdvLayout->addWidget( myInitialMemorySpin, 1, 1, 1, 1 );
475 anAdvLayout->addWidget( aMegabyteLabel2, 1, 2, 1, 1 );
476 anAdvLayout->addWidget( aWorkinDirLabel, 2, 0, 1, 1 );
477 anAdvLayout->addWidget( myWorkingDir, 2, 1, 1, 2 );
478 anAdvLayout->addWidget( dirBtn, 2, 3, 1, 1 );
479 anAdvLayout->addWidget( myKeepFiles, 3, 0, 1, 4 );
480 anAdvLayout->addWidget( aVerboseLevelLabel, 4, 0, 1, 1 );
481 anAdvLayout->addWidget( myVerboseLevelSpin, 4, 1, 1, 1 );
482 anAdvLayout->addWidget( myToCreateNewNodesCheck, 5, 0, 1, 4 );
483 anAdvLayout->addWidget( myRemoveInitialCentralPointCheck, 6, 0, 1, 4 );
484 anAdvLayout->addWidget( myBoundaryRecoveryCheck, 7, 0, 1, 4 );
485 anAdvLayout->addWidget( myFEMCorrectionCheck, 8, 0, 1, 4 );
486 anAdvLayout->addWidget( aTextOptionLabel, 9, 0, 1, 1 );
487 anAdvLayout->addWidget( myTextOption, 9, 1, 1, 2 );
489 // Enforced vertices parameters
490 myEnfGroup = new QWidget();
491 QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
493 myEnforcedTableWidget = new QTableWidget(myEnfGroup);
494 myEnforcedTableWidget ->setMinimumWidth(300);
495 myEnforcedTableWidget->setRowCount( 0 );
496 myEnforcedTableWidget->setColumnCount( ENF_VER_NB_COLUMNS );
497 myEnforcedTableWidget->setSortingEnabled(true);
498 QStringList enforcedHeaders;
499 enforcedHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
500 << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
501 << tr( "GHS3D_ENF_SIZE_COLUMN" ) << tr("GHS3D_ENF_ENTRY_COLUMN") << tr("GHS3D_ENF_VER_COMPOUND_COLUMN") << tr( "GHS3D_ENF_GROUP_COLUMN" );
503 myEnforcedTableWidget->setHorizontalHeaderLabels(enforcedHeaders);
504 myEnforcedTableWidget->verticalHeader()->hide();
505 myEnforcedTableWidget->horizontalHeader()->setStretchLastSection(true);
506 myEnforcedTableWidget->setAlternatingRowColors(true);
507 myEnforcedTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
508 myEnforcedTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
509 myEnforcedTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
510 myEnforcedTableWidget->resizeColumnsToContents();
511 myEnforcedTableWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
512 myEnforcedTableWidget->hideColumn(ENF_VER_COMPOUND_COLUMN);
514 myEnforcedTableWidget->setItemDelegate(new EnforcedVertexTableWidgetDelegate());
517 TColStd_MapOfInteger shapeTypes;
518 shapeTypes.Add( TopAbs_VERTEX );
519 shapeTypes.Add( TopAbs_COMPOUND );
521 SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes);
522 myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true, /*stretch=*/false);
523 myEnfVertexWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_VERTEX"), "QLineEdit { color: grey }");
525 QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_X_LABEL" ), myEnfGroup );
526 myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
527 myXCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
528 QLabel* myYCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Y_LABEL" ), myEnfGroup );
529 myYCoord = new SMESHGUI_SpinBox(myEnfGroup);
530 myYCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
531 QLabel* myZCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Z_LABEL" ), myEnfGroup );
532 myZCoord = new SMESHGUI_SpinBox(myEnfGroup);
533 myZCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
534 QLabel* mySizeLabel = new QLabel( tr( "GHS3D_ENF_SIZE_LABEL" ), myEnfGroup );
535 mySizeValue = new SMESHGUI_SpinBox(myEnfGroup);
536 mySizeValue->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
538 QLabel* myGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfGroup );
539 myGroupName = new QLineEdit(myEnfGroup);
541 addVertexButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfGroup);
542 addVertexButton->setEnabled(false);
543 removeVertexButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfGroup);
544 // myGlobalGroupName = new QCheckBox(tr("GHS3D_ENF_VER_GROUPS"), myEnfGroup);
545 // myGlobalGroupName->setChecked(false);
547 QGroupBox* GroupBox = new QGroupBox( myEnfGroup );
548 QLabel* info = new QLabel( GroupBox );
549 info->setText( tr( "GHS3D_ENF_VER_INFO" ) );
550 info->setWordWrap( true );
551 QVBoxLayout* GroupBoxVLayout = new QVBoxLayout( GroupBox );
552 GroupBoxVLayout->setSpacing( 6 );
553 GroupBoxVLayout->setMargin( 11 );
554 GroupBoxVLayout->addWidget( info );
557 anEnfLayout->addWidget(GroupBox, ENF_VER_WARNING, 0, 1, 2 );
558 anEnfLayout->addWidget(myEnforcedTableWidget, ENF_VER_VERTEX, 0, ENF_VER_NB_LINES, 1);
560 QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
561 anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
562 anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
563 anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
564 anEnfLayout2->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 0, 1, 1);
565 anEnfLayout2->addWidget(myYCoord, ENF_VER_Y_COORD, 1, 1, 1);
566 anEnfLayout2->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 0, 1, 1);
567 anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1);
568 anEnfLayout2->addWidget(mySizeLabel, ENF_VER_SIZE, 0, 1, 1);
569 anEnfLayout2->addWidget(mySizeValue, ENF_VER_SIZE, 1, 1, 1);
570 anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1);
571 anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1);
572 anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
573 anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
574 anEnfLayout2->setRowStretch(ENF_VER_NB_LINES, 1);
576 anEnfLayout->addLayout(anEnfLayout2, ENF_VER_VERTEX, 1,ENF_VER_NB_LINES, 1);
577 anEnfLayout->setRowStretch(ENF_VER_VERTEX, 10);
580 // Enforced meshes parameters
581 myEnfMeshGroup = new QWidget();
582 QGridLayout* anEnfMeshLayout = new QGridLayout(myEnfMeshGroup);
584 myEnforcedMeshTableWidget = new QTableWidget(myEnfGroup);
585 myEnforcedMeshTableWidget->setRowCount( 0 );
586 myEnforcedMeshTableWidget->setColumnCount( ENF_MESH_NB_COLUMNS );
587 myEnforcedMeshTableWidget->setSortingEnabled(true);
588 myEnforcedMeshTableWidget->verticalHeader()->hide();
589 QStringList enforcedMeshHeaders;
590 enforcedMeshHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
591 << tr( "GHS3D_ENF_ENTRY_COLUMN" )
592 << tr( "GHS3D_ENF_MESH_CONSTRAINT_COLUMN" )
593 << tr( "GHS3D_ENF_SIZE_COLUMN" )
594 << tr( "GHS3D_ENF_GROUP_COLUMN" );
595 myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
596 myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
597 myEnforcedMeshTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
598 myEnforcedMeshTableWidget->setAlternatingRowColors(true);
599 myEnforcedMeshTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
600 myEnforcedMeshTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
601 myEnforcedMeshTableWidget->resizeColumnsToContents();
602 myEnforcedMeshTableWidget->hideColumn(ENF_MESH_ENTRY_COLUMN);
604 myEnforcedMeshTableWidget->setItemDelegate(new EnforcedMeshTableWidgetDelegate());
606 // myEnfMesh = SMESH::SMESH_Mesh::_nil();
607 // myEnfMeshArray = new SMESH::mesh_array();
609 myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
610 myEnfMeshWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_MESH"), "QLineEdit { color: grey }");
612 myEnfMeshWdg->AvoidSimultaneousSelection(myEnfVertexWdg);
614 QLabel* myMeshConstraintLabel = new QLabel( tr( "GHS3D_ENF_MESH_CONSTRAINT_LABEL" ), myEnfMeshGroup );
615 myEnfMeshConstraint = new QComboBox(myEnfMeshGroup);
616 myEnfMeshConstraint->insertItems(0,myEnfMeshConstraintLabels);
617 myEnfMeshConstraint->setEditable(false);
618 myEnfMeshConstraint->setCurrentIndex(0);
620 QLabel* myMeshSizeLabel = new QLabel( tr( "GHS3D_ENF_SIZE_LABEL" ), myEnfMeshGroup );
621 myMeshSizeValue = new SMESHGUI_SpinBox(myEnfMeshGroup);
622 myMeshSizeValue->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
624 QLabel* myMeshGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfMeshGroup );
625 myMeshGroupName = new QLineEdit(myEnfMeshGroup);
627 addEnfMeshButton = new QPushButton(tr("GHS3D_ENF_ADD"),myEnfMeshGroup);
628 // addEnfMeshButton->setEnabled(false);
629 removeEnfMeshButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfMeshGroup);
631 QGroupBox* GroupBox2 = new QGroupBox( myEnfMeshGroup );
632 QLabel* info2 = new QLabel( GroupBox2 );
633 info2->setText( tr( "GHS3D_ENF_MESH_INFO" ) );
634 info2->setWordWrap( true );
635 QVBoxLayout* GroupBox2VLayout = new QVBoxLayout( GroupBox2 );
636 GroupBox2VLayout->setSpacing( 6 );
637 GroupBox2VLayout->setMargin( 11 );
638 GroupBox2VLayout->addWidget( info2 );
640 anEnfMeshLayout->addWidget( GroupBox2, ENF_MESH_WARNING, 0, 1, 2 );
641 anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH, 0, ENF_MESH_NB_LINES , 1);
643 QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup);
644 anEnfMeshLayout2->addWidget(myEnfMeshWdg, ENF_MESH_MESH, 0, 1, 2);
645 anEnfMeshLayout2->addWidget(myMeshConstraintLabel, ENF_MESH_CONSTRAINT, 0, 1, 1);
646 anEnfMeshLayout2->addWidget(myEnfMeshConstraint, ENF_MESH_CONSTRAINT, 1, 1, 1);
647 anEnfMeshLayout2->addWidget(myMeshSizeLabel, ENF_MESH_SIZE, 0, 1, 1);
648 anEnfMeshLayout2->addWidget(myMeshSizeValue, ENF_MESH_SIZE, 1, 1, 1);
649 anEnfMeshLayout2->addWidget(myMeshGroupNameLabel, ENF_MESH_GROUP, 0, 1, 1);
650 anEnfMeshLayout2->addWidget(myMeshGroupName, ENF_MESH_GROUP, 1, 1, 1);
651 anEnfMeshLayout2->addWidget(addEnfMeshButton, ENF_MESH_BTN, 0, 1, 1);
652 anEnfMeshLayout2->addWidget(removeEnfMeshButton, ENF_MESH_BTN, 1, 1, 1);
653 anEnfMeshLayout2->setRowStretch(ENF_MESH_NB_LINES, 1);
655 anEnfMeshLayout->addLayout(anEnfMeshLayout2, ENF_MESH_MESH, 1, ENF_MESH_NB_LINES, 1);
656 anEnfMeshLayout->setRowStretch(ENF_MESH_MESH, 10);
659 tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
660 tab->insertTab( ADV_TAB, myAdvGroup, tr( "GHS3D_ADV_ARGS" ) );
661 tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "GHS3D_ENFORCED_VERTICES" ) );
662 tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "GHS3D_ENFORCED_MESHES" ) );
663 tab->setCurrentIndex( STD_TAB );
666 connect( myMaximumMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
667 connect( myInitialMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
668 connect( myBoundaryRecoveryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
669 connect( dirBtn, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) );
670 connect( myEnforcedTableWidget, SIGNAL( itemClicked(QTableWidgetItem *)), this, SLOT( synchronizeCoords() ) );
671 connect( myEnforcedTableWidget, SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
672 connect( myEnforcedTableWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
673 connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertex() ) );
674 connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
675 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
676 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
677 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
678 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
679 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
680 connect( mySizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
681 connect( myXCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
682 connect( myYCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
683 connect( myZCoord, SIGNAL( valueChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
684 connect( mySizeValue, SIGNAL( valueChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) );
685 connect( this, SIGNAL( vertexDefined(bool) ), addVertexButton, SLOT( setEnabled(bool) ) );
687 connect( addEnfMeshButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedMesh() ) );
688 connect( removeEnfMeshButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedMesh() ) );
689 // connect( myEnfMeshWdg, SIGNAL( contentModified()), this, SLOT( checkEnfMeshIsDefined() ) );
690 // connect( myEnfMeshConstraint, SIGNAL( currentIndexChanged(int) ), this, SLOT( checkEnfMeshIsDefined() ) );
691 // connect( myMeshSizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkEnfMeshIsDefined() ) );
692 // connect( this, SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
698 * This method checks if an enforced vertex is defined;
700 void GHS3DPluginGUI_HypothesisCreator::clearEnfVertexSelection()
702 if (myEnfVertexWdg->NbObjects() != 0) {
703 disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
704 disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
705 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
706 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
707 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( checkVertexIsDefined() ) );
709 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
710 that->checkVertexIsDefined();
714 * This method checks if an enforced vertex is defined;
716 void GHS3DPluginGUI_HypothesisCreator::checkVertexIsDefined()
718 bool enfVertexIsDefined = false;
719 enfVertexIsDefined = (!mySizeValue->GetString().isEmpty() &&
720 (!myEnfVertexWdg->NbObjects() == 0 ||
721 (myEnfVertexWdg->NbObjects() == 0 && !myXCoord->GetString().isEmpty()
722 && !myYCoord->GetString().isEmpty()
723 && !myZCoord->GetString().isEmpty())));
724 emit vertexDefined(enfVertexIsDefined);
728 * This method checks if an enforced mesh is defined;
730 void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
732 emit enfMeshDefined((!myMeshSizeValue->GetString().isEmpty() && !myEnfVertexWdg->NbObjects() == 0));
736 * This method resets the content of the X, Y, Z, size and GroupName widgets;
738 void GHS3DPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
740 myXCoord->setCleared(true);
741 myYCoord->setCleared(true);
742 myZCoord->setCleared(true);
743 // mySizeValue->setCleared(true);
744 myXCoord->setText("");
745 myYCoord->setText("");
746 myZCoord->setText("");
747 // mySizeValue->setText("");
748 // myGroupName->setText("");
749 addVertexButton->setEnabled(false);
752 /** GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item)
753 This method updates the tooltip of a modified item. The QLineEdit widgets content
754 is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
756 void GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item) {
757 // MESSAGE("GHS3DPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
758 int row = myEnforcedTableWidget->row(item);
760 QVariant vertexName = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole);
761 QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
762 QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
763 QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
764 QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
765 QVariant entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
766 QString groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole).toString();
768 clearEnforcedVertexWidgets();
770 if ( !x.isNull() || !entry.isNull()) {
771 QString toolTip = vertexName.toString();
772 toolTip += QString("(");
773 if (entry.isNull() || (!entry.isNull() && entry.toString() == "")) {
774 toolTip += x.toString();
775 toolTip += QString(", ") + y.toString();
776 toolTip += QString(", ") + z.toString();
779 toolTip += entry.toString();
780 toolTip += QString(")");
783 toolTip += QString("=") + size.toString();
785 if (!groupName.isEmpty())
786 toolTip += QString(" [") + groupName + QString("]");
788 // MESSAGE("Tooltip: " << toolTip.toStdString());
789 for (int col=0;col<ENF_VER_NB_COLUMNS;col++)
790 myEnforcedTableWidget->item(row,col)->setToolTip(toolTip);
793 disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
794 disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
795 disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
796 myXCoord->SetValue(x.toDouble());
797 myYCoord->SetValue(y.toDouble());
798 myZCoord->SetValue(z.toDouble());
799 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
800 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
801 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
804 mySizeValue->SetValue(size.toDouble());
806 if (!groupName.isEmpty())
807 myGroupName->setText(groupName);
811 void GHS3DPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
812 int nbSelEnfVertex = myEnfVertexWdg->NbObjects();
813 clearEnforcedVertexWidgets();
814 if (nbSelEnfVertex == 1)
816 if ( CORBA::is_nil( getGeomEngine() ) && !GeometryGUI::InitGeomGen() )
819 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
820 if (myEnfVertex == GEOM::GEOM_Object::_nil())
822 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
823 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
824 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
825 if (CORBA::is_nil(measureOp))
829 measureOp->PointCoordinates (myEnfVertex, x, y, z);
830 if ( measureOp->IsDone() )
832 disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
833 disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
834 disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
835 myXCoord->SetValue(x);
836 myYCoord->SetValue(y);
837 myZCoord->SetValue(z);
838 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
839 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
840 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
846 /** GHS3DPluginGUI_HypothesisCreator::synchronizeCoords()
847 This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
848 of the enforced vertex clicked in the tree widget.
850 void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() {
851 clearEnforcedVertexWidgets();
852 QList<QTableWidgetItem *> items = myEnforcedTableWidget->selectedItems();
853 // myEnfVertexWdg->disconnect(SIGNAL(contentModified()));
854 disconnect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
855 if (! items.isEmpty()) {
856 QTableWidgetItem *item;
859 if (items.size() == 1) {
861 row = myEnforcedTableWidget->row(item);
862 QVariant x = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data( Qt::EditRole);
863 QVariant y = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data( Qt::EditRole);
864 QVariant z = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data( Qt::EditRole);
865 QVariant size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data( Qt::EditRole);
866 entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
867 if (!entry.isNull()) {
868 SMESH::string_array_var objIds = new SMESH::string_array;
870 objIds[0] = entry.toString().toStdString().c_str();
871 myEnfVertexWdg->SetObjects(objIds);
874 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
876 QVariant group = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data( Qt::EditRole);
877 if (!x.isNull()/* && entry.isNull()*/) {
878 // disconnect( myXCoord, SIGNAL( textChanged(const QString &)), this, SLOT( onSelectEnforcedVertex() ) );
879 disconnect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
880 disconnect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
881 disconnect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
882 myXCoord->SetValue(x.toDouble());
883 myYCoord->SetValue(y.toDouble());
884 myZCoord->SetValue(z.toDouble());
885 connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
886 connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
887 connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( clearEnfVertexSelection() ) );
890 mySizeValue->SetValue(size.toDouble());
892 if (!group.isNull() && (!x.isNull() || !entry.isNull()))
893 myGroupName->setText(group.toString());
896 QList<QString> entryList;
897 for (int i = 0; i < items.size(); ++i) {
899 row = myEnforcedTableWidget->row(item);
900 entry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data( Qt::EditRole);
902 entryList << entry.toString();
904 if (entryList.size() > 0) {
905 SMESH::string_array_var objIds = new SMESH::string_array;
906 objIds->length(entryList.size());
907 for (int i = 0; i < entryList.size() ; i++)
908 objIds[i] = entryList.at(i).toStdString().c_str();
909 myEnfVertexWdg->SetObjects(objIds);
912 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
917 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
919 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
920 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
921 that->checkVertexIsDefined();
924 /** GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh( meshName, geomEntry, elemType, size, groupName)
925 This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
927 void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, double size, std::string groupName)
929 MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", " << size << ", \"" << groupName << "\")");
930 bool okToCreate = true;
931 QString itemEntry = "";
932 int itemElementType = 0;
933 int rowCount = myEnforcedMeshTableWidget->rowCount();
934 bool allColumns = true;
935 for (int row = 0;row<rowCount;row++) {
936 for (int col = 0 ; col < ENF_MESH_NB_COLUMNS ; col++) {
937 MESSAGE("col: " << col);
938 if (col == ENF_MESH_CONSTRAINT_COLUMN){
939 if (qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col)) == 0) {
941 MESSAGE("allColumns = false");
945 else if (myEnforcedMeshTableWidget->item(row, col) == 0) {
947 MESSAGE("allColumns = false");
950 if (col == ENF_MESH_CONSTRAINT_COLUMN) {
951 QComboBox* itemComboBox = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col));
952 itemElementType = itemComboBox->currentIndex();
953 MESSAGE("itemElementType: " << itemElementType);
955 else if (col == ENF_MESH_ENTRY_COLUMN)
956 itemEntry = myEnforcedMeshTableWidget->item(row, col)->data(Qt::EditRole).toString();
962 if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) {
964 // if (itemSize != size) {
965 // MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
966 // myEnforcedMeshTableWidget->item(row, ENF_MESH_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
968 // // update group name
969 // if (itemGroupName.toStdString() != groupName) {
970 // MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
971 // myEnforcedMeshTableWidget->item(row, ENF_MESH_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
982 MESSAGE("Creation of enforced mesh");
984 myEnforcedMeshTableWidget->setRowCount(rowCount+1);
985 myEnforcedMeshTableWidget->setSortingEnabled(false);
987 for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
988 MESSAGE("Column: " << col);
989 if (col == ENF_MESH_CONSTRAINT_COLUMN) {
990 QComboBox* comboBox = new QComboBox();
991 QPalette pal = comboBox->palette();
992 pal.setColor(QPalette::Button, Qt::white);
993 comboBox->setPalette(pal);
994 comboBox->insertItems(0,myEnfMeshConstraintLabels);
995 comboBox->setEditable(false);
996 comboBox->setCurrentIndex(elementType);
997 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
998 myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
1001 QTableWidgetItem* item = new QTableWidgetItem();
1002 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1004 case ENF_MESH_NAME_COLUMN:
1005 item->setData( 0, name.c_str() );
1006 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
1007 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1008 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1010 case ENF_MESH_ENTRY_COLUMN:
1011 item->setData( 0, entry.c_str() );
1012 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
1013 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1014 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1016 case ENF_MESH_SIZE_COLUMN:
1017 item->setData( 0, size );
1018 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1019 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1021 case ENF_MESH_GROUP_COLUMN:
1022 item->setData( 0, groupName.c_str() );
1023 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1024 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1033 // connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1035 myEnforcedMeshTableWidget->setSortingEnabled(true);
1036 // myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1037 // updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1041 /** GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex( x, y, z, size, vertexName, geomEntry, groupName)
1042 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.
1044 void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, double size, std::string vertexName, std::string geomEntry, std::string groupName, bool isCompound)
1046 MESSAGE("addEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ", \"" << vertexName << ", \"" << geomEntry << "\", \"" << groupName << "\", " << isCompound << ")");
1047 myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
1048 bool okToCreate = true;
1049 double itemX,itemY,itemZ,itemSize = 0;
1050 QString itemEntry, itemGroupName = QString("");
1051 // bool itemIsCompound;
1052 int rowCount = myEnforcedTableWidget->rowCount();
1055 for (int row = 0;row<rowCount;row++) {
1057 for (int col = 0 ; col < ENF_VER_NB_COLUMNS ; col++) {
1058 if (myEnforcedTableWidget->item(row, col) == 0) {
1063 data = myEnforcedTableWidget->item(row, col)->data(Qt::EditRole);
1064 if (!data.isNull()) {
1066 case ENF_VER_GROUP_COLUMN:
1067 itemGroupName = data.toString();
1069 case ENF_VER_ENTRY_COLUMN:
1070 itemEntry = data.toString();
1072 // case ENF_VER_COMPOUND_COLUMN:
1073 // itemIsCompound = data.toBool();
1075 case ENF_VER_X_COLUMN:
1076 itemX = data.toDouble();
1078 case ENF_VER_Y_COLUMN:
1079 itemY = data.toDouble();
1081 case ENF_VER_Z_COLUMN:
1082 itemZ = data.toDouble();
1084 case ENF_VER_SIZE_COLUMN:
1085 itemSize = data.toDouble();
1097 if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) {
1099 if (itemSize != size) {
1100 MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
1101 myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
1103 // update group name
1104 if (itemGroupName.toStdString() != groupName) {
1105 MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
1106 myEnforcedTableWidget->item(row, ENF_VER_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
1113 if (geomEntry.empty()) {
1114 MESSAGE("Vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
1117 MESSAGE("Vertex with entry " << geomEntry << " already exist: dont create again");
1122 if (geomEntry.empty()) {
1123 MESSAGE("Vertex with coords " << x << ", " << y << ", " << z<< " is created");
1126 MESSAGE("Vertex with geom entry " << geomEntry << " is created");
1131 QString myVertexName;
1132 while(indexRef != vertexIndex) {
1133 indexRef = vertexIndex;
1134 if (vertexName.empty())
1135 myVertexName = QString("Vertex #%1").arg(vertexIndex);
1137 myVertexName = QString(vertexName.c_str());
1139 for (int row = 0;row<rowCount;row++) {
1140 QString name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString();
1141 if (myVertexName == name) {
1148 MESSAGE("myVertexName is \"" << myVertexName.toStdString() << "\"");
1149 myEnforcedTableWidget->setRowCount(rowCount+1);
1150 myEnforcedTableWidget->setSortingEnabled(false);
1151 for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
1152 MESSAGE("Column: " << col);
1153 QTableWidgetItem* item = new QTableWidgetItem();
1154 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1156 case ENF_VER_NAME_COLUMN:
1157 item->setData( Qt::EditRole, myVertexName );
1158 if (!geomEntry.empty()) {
1160 item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1162 item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1165 case ENF_VER_X_COLUMN:
1167 item->setData( 0, QVariant(x) );
1169 case ENF_VER_Y_COLUMN:
1171 item->setData( 0, QVariant(y) );
1173 case ENF_VER_Z_COLUMN:
1175 item->setData( 0, QVariant(z) );
1177 case ENF_VER_SIZE_COLUMN:
1178 item->setData( 0, QVariant(size) );
1180 case ENF_VER_ENTRY_COLUMN:
1181 if (!geomEntry.empty())
1182 item->setData( 0, QString(geomEntry.c_str()) );
1184 case ENF_VER_COMPOUND_COLUMN:
1185 item->setData( Qt::CheckStateRole, isCompound );
1186 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
1188 case ENF_VER_GROUP_COLUMN:
1189 if (!groupName.empty())
1190 item->setData( 0, QString(groupName.c_str()) );
1196 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1197 myEnforcedTableWidget->setItem(rowCount,col,item);
1201 connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1203 myEnforcedTableWidget->setSortingEnabled(true);
1204 // myEnforcedTableWidget->setCurrentItem(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1205 updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1208 /** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
1209 This method is called when a item is added into the enforced meshes tree widget
1211 void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
1213 MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()");
1215 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
1217 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1218 myEnfMeshWdg->deactivateSelection();
1220 for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
1221 myEnforcedMeshTableWidget->resizeColumnToContents(column);
1224 int selEnfMeshes = myEnfMeshWdg->NbObjects();
1225 if (selEnfMeshes == 0)
1228 std::string groupName = myMeshGroupName->text().toStdString();
1229 // if (myGlobalGroupName->isChecked())
1230 // groupName = myGlobalGroupName->text().toStdString();
1232 if (boost::trim_copy(groupName).empty())
1237 if (!myMeshSizeValue->GetString().isEmpty())
1238 size = myMeshSizeValue->GetValue();
1242 int elementType = myEnfMeshConstraint->currentIndex();
1245 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1246 _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
1247 QString meshEntry = myEnfMeshWdg->GetValue();
1248 MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
1250 if (selEnfMeshes == 1)
1252 MESSAGE("1 SMESH object selected");
1253 // myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
1254 // std::string entry = myEnfMeshWdg->GetValue();
1255 aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
1256 CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
1257 if (!CORBA::is_nil(anObj)) {
1258 // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
1259 addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName);
1264 MESSAGE(selEnfMeshes << " SMESH objects selected");
1265 QStringList meshEntries = meshEntry.split(" ", QString::SkipEmptyParts);
1266 QStringListIterator meshEntriesIt (meshEntries);
1267 while (meshEntriesIt.hasNext()) {
1268 aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
1269 CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
1270 if (!CORBA::is_nil(anObj)) {
1271 // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
1272 addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName);
1277 myEnfVertexWdg->SetObject(SMESH::SMESH_IDSource::_nil());
1279 for (int column = 0; column < myEnforcedMeshTableWidget->columnCount(); ++column)
1280 myEnforcedMeshTableWidget->resizeColumnToContents(column);
1284 /** GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
1285 This method is called when a item is added into the enforced vertices tree widget
1287 void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
1289 MESSAGE("GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()");
1291 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
1293 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1294 myEnfVertexWdg->deactivateSelection();
1296 for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
1297 myEnforcedTableWidget->resizeColumnToContents(column);
1300 int selEnfVertex = myEnfVertexWdg->NbObjects();
1301 bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
1302 if ((selEnfVertex == 0) && coordsEmpty)
1305 std::string groupName = myGroupName->text().toStdString();
1306 // if (myGlobalGroupName->isChecked())
1307 // groupName = myGlobalGroupName->text().toStdString();
1309 if (boost::trim_copy(groupName).empty())
1312 double size = mySizeValue->GetValue();
1314 if (selEnfVertex <= 1)
1316 MESSAGE("0 or 1 GEOM object selected");
1317 double x = 0, y = 0, z=0;
1318 if (myXCoord->GetString() != "") {
1319 x = myXCoord->GetValue();
1320 y = myYCoord->GetValue();
1321 z = myZCoord->GetValue();
1323 if (selEnfVertex == 1) {
1324 MESSAGE("1 GEOM object selected");
1325 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
1326 std::string entry = "";
1327 if (myEnfVertex != GEOM::GEOM_Object::_nil())
1328 entry = myEnfVertex->GetStudyEntry();
1329 addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),entry, groupName, myEnfVertex->GetShapeType() == GEOM::COMPOUND);
1332 MESSAGE("0 GEOM object selected");
1333 MESSAGE("Coords: ("<<x<<","<<y<<","<<z<<")");
1334 addEnforcedVertex(x, y, z, size, "", "", groupName);
1339 if ( CORBA::is_nil(getGeomEngine()))
1342 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
1343 if (CORBA::is_nil(measureOp))
1346 CORBA::Double x = 0, y = 0,z = 0;
1347 for (int j = 0 ; j < selEnfVertex ; j++)
1349 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(j);
1350 if (myEnfVertex == GEOM::GEOM_Object::_nil())
1352 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
1353 measureOp->PointCoordinates (myEnfVertex, x, y, z);
1354 if ( measureOp->IsDone() )
1355 addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
1356 } else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
1357 addEnforcedVertex(0., 0., 0., size, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName, true);
1362 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
1364 for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
1365 myEnforcedTableWidget->resizeColumnToContents(column);
1368 /** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
1369 This method is called when a item is removed from the enforced meshes tree widget
1371 void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
1373 QList<int> selectedRows;
1374 QList<QTableWidgetItem *> selectedItems = myEnforcedMeshTableWidget->selectedItems();
1375 QTableWidgetItem* item;
1377 foreach( item, selectedItems ) {
1379 if (!selectedRows.contains( row ) )
1380 selectedRows.append(row);
1383 qSort( selectedRows );
1384 QListIterator<int> it( selectedRows );
1386 while ( it.hasPrevious() ) {
1387 row = it.previous();
1388 MESSAGE("delete row #"<< row);
1389 myEnforcedMeshTableWidget->removeRow(row );
1392 myEnforcedMeshTableWidget->selectionModel()->clearSelection();
1395 /** GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
1396 This method is called when a item is removed from the enforced vertices tree widget
1398 void GHS3DPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
1400 QList<int> selectedRows;
1401 QList<QTableWidgetItem *> selectedItems = myEnforcedTableWidget->selectedItems();
1402 QTableWidgetItem* item;
1404 foreach( item, selectedItems ) {
1406 if (!selectedRows.contains( row ) )
1407 selectedRows.append(row);
1410 qSort( selectedRows );
1411 QListIterator<int> it( selectedRows );
1413 while ( it.hasPrevious() ) {
1414 row = it.previous();
1415 MESSAGE("delete row #"<< row);
1416 myEnforcedTableWidget->removeRow(row );
1419 myEnforcedTableWidget->selectionModel()->clearSelection();
1422 void GHS3DPluginGUI_HypothesisCreator::onDirBtnClicked()
1424 QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myWorkingDir->text(), QString() );
1425 if ( !dir.isEmpty() )
1426 myWorkingDir->setText( dir );
1429 void GHS3DPluginGUI_HypothesisCreator::updateWidgets()
1431 myMaximumMemorySpin->setEnabled( myMaximumMemoryCheck->isChecked() );
1432 myInitialMemoryCheck->setEnabled( !myBoundaryRecoveryCheck->isChecked() );
1433 myInitialMemorySpin->setEnabled( myInitialMemoryCheck->isChecked() && !myBoundaryRecoveryCheck->isChecked() );
1434 myOptimizationLevelCombo->setEnabled( !myBoundaryRecoveryCheck->isChecked() );
1437 bool GHS3DPluginGUI_HypothesisCreator::checkParams(QString& msg) const
1439 MESSAGE("GHS3DPluginGUI_HypothesisCreator::checkParams");
1441 if ( !QFileInfo( myWorkingDir->text().trimmed() ).isWritable() ) {
1442 SUIT_MessageBox::warning( dlg(),
1443 tr( "SMESH_WRN_WARNING" ),
1444 tr( "GHS3D_PERMISSION_DENIED" ) );
1451 void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
1453 MESSAGE("GHS3DPluginGUI_HypothesisCreator::retrieveParams");
1454 GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
1455 GHS3DHypothesisData data;
1456 readParamsFromHypo( data );
1459 myName->setText( data.myName );
1461 myToMeshHolesCheck ->setChecked ( data.myToMeshHoles );
1462 myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
1463 myMaximumMemoryCheck ->setChecked ( data.myMaximumMemory > 0 );
1464 myMaximumMemorySpin ->setValue ( qMax( data.myMaximumMemory,
1465 myMaximumMemorySpin->minimum() ));
1466 myInitialMemoryCheck ->setChecked ( data.myInitialMemory > 0 );
1467 myInitialMemorySpin ->setValue ( qMax( data.myInitialMemory,
1468 myInitialMemorySpin->minimum() ));
1469 myWorkingDir ->setText ( data.myWorkingDir );
1470 myKeepFiles ->setChecked ( data.myKeepFiles );
1471 myVerboseLevelSpin ->setValue ( data.myVerboseLevel );
1472 myToCreateNewNodesCheck ->setChecked ( data.myToCreateNewNodes );
1473 myRemoveInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint );
1474 myBoundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery );
1475 myFEMCorrectionCheck ->setChecked ( data.myFEMCorrection );
1476 myTextOption ->setText ( data.myTextOption );
1478 TEnfVertexList::const_iterator it;
1480 myEnforcedTableWidget->setSortingEnabled(false);
1481 myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
1482 for(it = data.myEnforcedVertices.begin() ; it != data.myEnforcedVertices.end(); it++ )
1484 TEnfVertex* enfVertex = (*it);
1485 myEnforcedTableWidget->setRowCount(rowCount+1);
1487 for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
1488 MESSAGE("Column: " << col);
1489 // MESSAGE("enfVertex->isCompound: " << enfVertex->isCompound);
1490 QTableWidgetItem* item = new QTableWidgetItem();
1491 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1493 case ENF_VER_NAME_COLUMN:
1494 item->setData( 0, enfVertex->name.c_str() );
1495 if (!enfVertex->geomEntry.empty()) {
1496 if (enfVertex->isCompound)
1497 item->setIcon(QIcon(iconCompound.scaled(iconCompound.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1499 item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1501 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1504 case ENF_VER_X_COLUMN:
1505 if (!enfVertex->isCompound) {
1506 item->setData( 0, enfVertex->coords.at(0) );
1507 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1510 case ENF_VER_Y_COLUMN:
1511 if (!enfVertex->isCompound) {
1512 item->setData( 0, enfVertex->coords.at(1) );
1513 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1516 case ENF_VER_Z_COLUMN:
1517 if (!enfVertex->isCompound) {
1518 item->setData( 0, enfVertex->coords.at(2) );
1519 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1522 case ENF_VER_SIZE_COLUMN:
1523 item->setData( 0, enfVertex->size );
1524 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1526 case ENF_VER_ENTRY_COLUMN:
1527 item->setData( 0, enfVertex->geomEntry.c_str() );
1528 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1530 case ENF_VER_COMPOUND_COLUMN:
1531 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
1532 item->setData( Qt::CheckStateRole, enfVertex->isCompound );
1533 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << enfVertex->isCompound);
1535 case ENF_VER_GROUP_COLUMN:
1536 item->setData( 0, enfVertex->groupName.c_str() );
1537 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1543 myEnforcedTableWidget->setItem(rowCount,col,item);
1546 that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1550 connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1551 myEnforcedTableWidget->setSortingEnabled(true);
1553 for (int column = 0; column < myEnforcedTableWidget->columnCount(); ++column)
1554 myEnforcedTableWidget->resizeColumnToContents(column);
1556 // Update Enforced meshes QTableWidget
1557 TEnfMeshList::const_iterator itMesh;
1559 myEnforcedMeshTableWidget->setSortingEnabled(false);
1560 // myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
1561 for(itMesh = data.myEnforcedMeshes.begin() ; itMesh != data.myEnforcedMeshes.end(); itMesh++ )
1563 TEnfMesh* enfMesh = (*itMesh);
1564 myEnforcedMeshTableWidget->setRowCount(rowCount+1);
1566 for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
1567 MESSAGE("Column: " << col);
1568 if (col == ENF_MESH_CONSTRAINT_COLUMN) {
1569 QComboBox* comboBox = new QComboBox();
1570 QPalette pal = comboBox->palette();
1571 pal.setColor(QPalette::Button, Qt::white);
1572 comboBox->setPalette(pal);
1573 comboBox->insertItems(0,myEnfMeshConstraintLabels);
1574 comboBox->setEditable(false);
1575 comboBox->setCurrentIndex(enfMesh->elementType);
1576 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
1577 myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
1580 QTableWidgetItem* item = new QTableWidgetItem();
1581 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1583 case ENF_MESH_NAME_COLUMN:
1584 item->setData( 0, enfMesh->name.c_str() );
1585 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
1586 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1587 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1589 case ENF_MESH_ENTRY_COLUMN:
1590 item->setData( 0, enfMesh->entry.c_str() );
1591 item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
1592 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1593 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1595 case ENF_MESH_SIZE_COLUMN:
1596 item->setData( 0, enfMesh->size );
1597 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1598 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1600 case ENF_MESH_GROUP_COLUMN:
1601 item->setData( 0, enfMesh->groupName.c_str() );
1602 MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
1603 myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1610 // myEnforcedMeshTableWidget->setItem(rowCount,col,item);
1613 // that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
1617 // connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
1618 myEnforcedMeshTableWidget->setSortingEnabled(true);
1620 for (int col=0;col<ENF_MESH_NB_COLUMNS;col++)
1621 myEnforcedMeshTableWidget->resizeColumnToContents(col);
1623 that->updateWidgets();
1624 that->checkVertexIsDefined();
1627 QString GHS3DPluginGUI_HypothesisCreator::storeParams() const
1629 MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParams");
1630 GHS3DHypothesisData data;
1631 readParamsFromWidgets( data );
1632 storeParamsToHypo( data );
1634 QString valStr = "";
1636 if ( !data.myBoundaryRecovery )
1637 valStr = "-c " + QString::number( !data.myToMeshHoles );
1639 if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
1640 const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
1642 valStr += level[ data.myOptimizationLevel ];
1644 if ( data.myMaximumMemory > 0 ) {
1646 valStr += QString::number( data.myMaximumMemory );
1648 if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
1650 valStr += QString::number( data.myInitialMemory );
1653 valStr += QString::number( data.myVerboseLevel );
1655 if ( !data.myToCreateNewNodes )
1658 if ( data.myRemoveInitialCentralPoint )
1659 valStr += " -no_initial_central_point";
1661 if ( data.myBoundaryRecovery )
1664 if ( data.myFEMCorrection )
1668 valStr += data.myTextOption;
1670 // valStr += " #BEGIN ENFORCED VERTICES#";
1671 // // Add size map parameters storage
1672 // for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
1674 // double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
1675 // double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
1676 // double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
1677 // double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
1678 // valStr += QString::number( x );
1680 // valStr += QString::number( y );
1682 // valStr += QString::number( z );
1684 // valStr += QString::number( size );
1685 // if (i!=mySmpModel->rowCount()-1)
1688 // valStr += " #END ENFORCED VERTICES#";
1689 // MESSAGE(valStr.toStdString());
1693 bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data ) const
1695 MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo");
1696 GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
1697 GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( initParamsHypothesis() );
1699 HypothesisData* data = SMESH::GetHypothesisData( hypType() );
1700 h_data.myName = isCreation() && data ? hypName() : "";
1702 h_data.myToMeshHoles = h->GetToMeshHoles();
1703 h_data.myMaximumMemory = h->GetMaximumMemory();
1704 h_data.myInitialMemory = h->GetInitialMemory();
1705 h_data.myInitialMemory = h->GetInitialMemory();
1706 h_data.myOptimizationLevel = h->GetOptimizationLevel();
1707 h_data.myKeepFiles = h->GetKeepFiles();
1708 h_data.myWorkingDir = h->GetWorkingDirectory();
1709 h_data.myVerboseLevel = h->GetVerboseLevel();
1710 h_data.myToCreateNewNodes = h->GetToCreateNewNodes();
1711 h_data.myRemoveInitialCentralPoint = h->GetToRemoveCentralPoint();
1712 h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion();
1713 h_data.myFEMCorrection = h->GetFEMCorrection();
1714 h_data.myTextOption = h->GetTextOption();
1716 GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
1717 MESSAGE("vertices->length(): " << vertices->length());
1718 h_data.myEnforcedVertices.clear();
1719 for (int i=0 ; i<vertices->length() ; i++) {
1720 TEnfVertex* myVertex = new TEnfVertex();
1721 myVertex->name = CORBA::string_dup(vertices[i].name.in());
1722 myVertex->geomEntry = CORBA::string_dup(vertices[i].geomEntry.in());
1723 myVertex->groupName = CORBA::string_dup(vertices[i].groupName.in());
1724 myVertex->size = vertices[i].size;
1725 myVertex->isCompound = vertices[i].isCompound;
1726 if (vertices[i].coords.length()) {
1727 for (int c = 0; c < vertices[i].coords.length() ; c++)
1728 myVertex->coords.push_back(vertices[i].coords[c]);
1729 MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
1731 h_data.myEnforcedVertices.insert(myVertex);
1734 GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
1735 MESSAGE("enfMeshes->length(): " << enfMeshes->length());
1736 h_data.myEnforcedMeshes.clear();
1737 for (int i=0 ; i<enfMeshes->length() ; i++) {
1738 TEnfMesh* myEnfMesh = new TEnfMesh();
1739 myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
1740 myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
1741 myEnfMesh->groupName = CORBA::string_dup(enfMeshes[i].groupName.in());
1742 myEnfMesh->size = enfMeshes[i].size;
1743 switch (enfMeshes[i].elementType) {
1745 myEnfMesh->elementType = 0;
1748 myEnfMesh->elementType = 1;
1751 myEnfMesh->elementType = 2;
1756 // myEnfMesh->elementType = enfMeshes[i].elementType;
1757 h_data.myEnforcedMeshes.insert(myEnfMesh);
1762 bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisData& h_data ) const
1764 MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo");
1765 GHS3DPlugin::GHS3DPlugin_Hypothesis_var h =
1766 GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( hypothesis() );
1772 SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
1774 if ( h->GetToMeshHoles() != h_data.myToMeshHoles ) // avoid duplication of DumpPython commands
1775 h->SetToMeshHoles ( h_data.myToMeshHoles );
1776 if ( h->GetMaximumMemory() != h_data.myMaximumMemory )
1777 h->SetMaximumMemory ( h_data.myMaximumMemory );
1778 if ( h->GetInitialMemory() != h_data.myInitialMemory )
1779 h->SetInitialMemory ( h_data.myInitialMemory );
1780 if ( h->GetInitialMemory() != h_data.myInitialMemory )
1781 h->SetInitialMemory ( h_data.myInitialMemory );
1782 if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel )
1783 h->SetOptimizationLevel( h_data.myOptimizationLevel );
1784 if ( h->GetKeepFiles() != h_data.myKeepFiles )
1785 h->SetKeepFiles ( h_data.myKeepFiles );
1786 if ( h->GetWorkingDirectory() != h_data.myWorkingDir )
1787 h->SetWorkingDirectory ( h_data.myWorkingDir.toLatin1().constData() );
1788 if ( h->GetVerboseLevel() != h_data.myVerboseLevel )
1789 h->SetVerboseLevel ( h_data.myVerboseLevel );
1790 if ( h->GetToCreateNewNodes() != h_data.myToCreateNewNodes )
1791 h->SetToCreateNewNodes( h_data.myToCreateNewNodes );
1792 if ( h->GetToRemoveCentralPoint() != h_data.myRemoveInitialCentralPoint )
1793 h->SetToRemoveCentralPoint( h_data.myRemoveInitialCentralPoint );
1794 if ( h->GetToUseBoundaryRecoveryVersion() != h_data.myBoundaryRecovery )
1795 h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery );
1796 if ( h->GetFEMCorrection() != h_data.myFEMCorrection )
1797 h->SetFEMCorrection( h_data.myFEMCorrection );
1798 if ( h->GetTextOption() != h_data.myTextOption )
1799 h->SetTextOption ( h_data.myTextOption.toLatin1().constData() );
1801 // Enforced vertices
1802 int nbVertex = (int) h_data.myEnforcedVertices.size();
1803 GHS3DPlugin::GHS3DEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices();
1804 int nbVertexHyp = vertexHyp->length();
1806 MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices");
1807 MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp);
1809 // 1. Clear all enforced vertices in hypothesis
1810 // 2. Add new enforced vertex according to h_data
1811 if ( nbVertexHyp > 0)
1812 h->ClearEnforcedVertices();
1814 TEnfVertexList::const_iterator it;
1815 double x = 0, y = 0, z = 0;
1816 for(it = h_data.myEnforcedVertices.begin() ; it != h_data.myEnforcedVertices.end(); it++ ) {
1817 TEnfVertex* enfVertex = (*it);
1819 if (enfVertex->coords.size()) {
1820 x = enfVertex->coords.at(0);
1821 y = enfVertex->coords.at(1);
1822 z = enfVertex->coords.at(2);
1824 ok = h->p_SetEnforcedVertex( enfVertex->size, x, y, z, enfVertex->name.c_str(), enfVertex->geomEntry.c_str(), enfVertex->groupName.c_str(), enfVertex->isCompound);
1828 int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
1829 GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshListHyp = h->GetEnforcedMeshes();
1830 int nbEnfMeshListHyp = enfMeshListHyp->length();
1832 MESSAGE("Store params for size maps: " << nbEnfMeshes << " enforced meshes");
1833 MESSAGE("h->GetEnforcedMeshes()->length(): " << nbEnfMeshListHyp);
1835 // 1. Clear all enforced vertices in hypothesis
1836 // 2. Add new enforced vertex according to h_data
1837 if ( nbEnfMeshListHyp > 0)
1838 h->ClearEnforcedMeshes();
1840 TEnfMeshList::const_iterator itEnfMesh;
1841 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1842 for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
1843 TEnfMesh* enfMesh = (*itEnfMesh);
1845 _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
1846 SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
1847 SMESH::ElementType elementType;
1848 MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
1849 switch(enfMesh->elementType) {
1851 elementType = SMESH::NODE;
1854 elementType = SMESH::EDGE;
1857 elementType = SMESH::FACE;
1863 ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->size, enfMesh->groupName.c_str());
1866 // catch(const std::exception& ex) {
1867 // std::cout << "Exception: " << ex.what() << std::endl;
1870 catch ( const SALOME::SALOME_Exception& ex )
1872 SalomeApp_Tools::QtCatchCorbaException( ex );
1878 bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisData& h_data ) const
1880 MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets");
1881 h_data.myName = myName ? myName->text() : "";
1882 h_data.myToMeshHoles = myToMeshHolesCheck->isChecked();
1883 h_data.myMaximumMemory = myMaximumMemoryCheck->isChecked() ? myMaximumMemorySpin->value() : -1;
1884 h_data.myInitialMemory = myInitialMemoryCheck->isChecked() ? myInitialMemorySpin->value() : -1;
1885 h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex();
1886 h_data.myKeepFiles = myKeepFiles->isChecked();
1887 h_data.myWorkingDir = myWorkingDir->text().trimmed();
1888 h_data.myVerboseLevel = myVerboseLevelSpin->value();
1889 h_data.myToCreateNewNodes = myToCreateNewNodesCheck->isChecked();
1890 h_data.myRemoveInitialCentralPoint = myRemoveInitialCentralPointCheck->isChecked();
1891 h_data.myBoundaryRecovery = myBoundaryRecoveryCheck->isChecked();
1892 h_data.myFEMCorrection = myFEMCorrectionCheck->isChecked();
1893 h_data.myTextOption = myTextOption->text();
1895 // Enforced vertices
1896 h_data.myEnforcedVertices.clear();
1897 QVariant valueX, valueY, valueZ;
1898 for (int row=0 ; row<myEnforcedTableWidget->rowCount() ; row++) {
1900 TEnfVertex *myVertex = new TEnfVertex();
1901 myVertex->name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
1902 MESSAGE("Add new enforced vertex \"" << myVertex->name << "\"" );
1903 myVertex->geomEntry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
1904 if (myVertex->geomEntry.size())
1905 MESSAGE("Geom entry is \"" << myVertex->geomEntry << "\"" );
1906 myVertex->groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
1907 if (myVertex->groupName.size())
1908 MESSAGE("Group name is \"" << myVertex->groupName << "\"" );
1909 valueX = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data(Qt::EditRole);
1910 valueY = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data(Qt::EditRole);
1911 valueZ = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data(Qt::EditRole);
1912 if (!valueX.isNull() && !valueY.isNull() && !valueZ.isNull()) {
1913 myVertex->coords.push_back(valueX.toDouble());
1914 myVertex->coords.push_back(valueY.toDouble());
1915 myVertex->coords.push_back(valueZ.toDouble());
1916 MESSAGE("Coords are (" << myVertex->coords.at(0) << ", "
1917 << myVertex->coords.at(1) << ", "
1918 << myVertex->coords.at(2) << ")");
1920 myVertex->size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
1921 MESSAGE("Size is " << myVertex->size);
1922 myVertex->isCompound = myEnforcedTableWidget->item(row,ENF_VER_COMPOUND_COLUMN)->data(Qt::CheckStateRole).toBool();
1923 MESSAGE("Is compound ? " << myVertex->isCompound);
1924 h_data.myEnforcedVertices.insert(myVertex);
1928 h_data.myEnforcedMeshes.clear();
1930 for (int row=0 ; row<myEnforcedMeshTableWidget->rowCount() ; row++) {
1932 TEnfMesh *myEnfMesh = new TEnfMesh();
1933 myEnfMesh->name = myEnforcedMeshTableWidget->item(row,ENF_MESH_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
1934 MESSAGE("Add new enforced mesh \"" << myEnfMesh->name << "\"" );
1935 myEnfMesh->entry = myEnforcedMeshTableWidget->item(row,ENF_MESH_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
1936 MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
1937 myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
1938 MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
1939 myEnfMesh->size = myEnforcedMeshTableWidget->item(row,ENF_MESH_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
1940 MESSAGE("Size is " << myEnfMesh->size);
1941 QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
1942 myEnfMesh->elementType = combo->currentIndex();
1943 MESSAGE("Element type: " << myEnfMesh->elementType);
1944 h_data.myEnforcedMeshes.insert(myEnfMesh);
1950 QString GHS3DPluginGUI_HypothesisCreator::caption() const
1952 return tr( "GHS3D_TITLE" );
1955 QPixmap GHS3DPluginGUI_HypothesisCreator::icon() const
1957 return SUIT_Session::session()->resourceMgr()->loadPixmap( "GHS3DPlugin", tr( "ICON_DLG_GHS3D_PARAMETERS" ) );
1960 QString GHS3DPluginGUI_HypothesisCreator::type() const
1962 return tr( "GHS3D_HYPOTHESIS" );
1965 QString GHS3DPluginGUI_HypothesisCreator::helpPage() const
1967 return "ghs3d_hypo_page.html";