1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : BLSURFPluginGUI_HypothesisCreator.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 // & Aurelien ALLEAUME (DISTENE)
24 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
27 #include "BLSURFPluginGUI_HypothesisCreator.h"
28 #include "BLSURFPluginGUI_Dlg.h"
30 #include <GeometryGUI.h>
32 #include <SMESHGUI_Dialog.h>
33 #include <SMESHGUI_HypothesesUtils.h>
34 #include <SMESHGUI_IdValidator.h>
35 #include <SMESHGUI_SpinBox.h>
36 #include <SMESHGUI_Utils.h>
37 #include <SMESH_Gen_i.hxx>
38 #include <SMESH_NumberFilter.hxx>
39 #include <StdMeshersGUI_SubShapeSelectorWdg.h>
41 #include <LightApp_SelectionMgr.h>
42 #include <SALOME_ListIO.hxx>
43 #include <SUIT_MessageBox.h>
44 #include <SUIT_ResourceMgr.h>
45 #include <SUIT_Session.h>
46 #include <SalomeApp_Application.h>
47 #include <SalomeApp_Tools.h>
49 #include <QApplication>
53 #include <QGridLayout>
55 #include <QHBoxLayout>
56 #include <QHeaderView>
60 #include <QModelIndexList>
62 #include <QPushButton>
63 #include <QRadioButton>
66 #include <QStandardItem>
67 #include <QStandardItemModel>
69 #include <QTableWidget>
70 #include <QTreeWidget>
71 #include <QTreeWidgetItem>
72 #include <QVBoxLayout>
74 #include <TopoDS_Shape.hxx>
75 #include <TopoDS_Iterator.hxx>
77 #include <structmember.h> // Python
95 TBL_MESHING = 0, TBL_PRECAD, TBL_CUSTOM,
97 // Enforced vertices array columns
98 ENF_VER_NAME_COLUMN = 0,
99 ENF_VER_FACE_ENTRY_COLUMN,
103 ENF_VER_ENTRY_COLUMN,
104 ENF_VER_GROUP_COLUMN,
107 PERIODICITY_OBJ_SOURCE_COLUMN = 0,
108 PERIODICITY_OBJ_TARGET_COLUMN,
109 PERIODICITY_P1_SOURCE_COLUMN,
110 PERIODICITY_P2_SOURCE_COLUMN,
111 PERIODICITY_P3_SOURCE_COLUMN,
112 PERIODICITY_P1_TARGET_COLUMN,
113 PERIODICITY_P2_TARGET_COLUMN,
114 PERIODICITY_P3_TARGET_COLUMN,
115 PERIODICITY_SHAPE_TYPE,
117 // PERIODICITY_OBJ_SOURCE_COLUMN = 0,
118 // PERIODICITY_ENTRY_SOURCE_COLUMN,
119 // PERIODICITY_OBJ_TARGET_COLUMN,
120 // PERIODICITY_ENTRY_TARGET_COLUMN,
121 // PERIODICITY_P1_SOURCE_COLUMN,
122 // PERIODICITY_P1_ENTRY_SOURCE_COLUMN,
123 // PERIODICITY_P2_SOURCE_COLUMN,
124 // PERIODICITY_P2_ENTRY_SOURCE_COLUMN,
125 // PERIODICITY_P3_SOURCE_COLUMN,
126 // PERIODICITY_P3_ENTRY_SOURCE_COLUMN,
127 // PERIODICITY_P1_TARGET_COLUMN,
128 // PERIODICITY_P1_ENTRY_TARGET_COLUMN,
129 // PERIODICITY_P2_TARGET_COLUMN,
130 // PERIODICITY_P2_ENTRY_TARGET_COLUMN,
131 // PERIODICITY_P3_TARGET_COLUMN,
132 // PERIODICITY_P3_ENTRY_TARGET_COLUMN,
134 PERIODICITY_NB_COLUMN
160 // Enforced vertices inputs
168 // ENF_VER_GROUP_CHECK,
172 ENF_VER_INTERNAL_ALL_FACES,
173 ENF_VER_INTERNAL_ALL_FACES_GROUP,
174 // ENF_VER_VERTEX_BTN,
175 // ENF_VER_REMOVE_BTN,
176 // ENF_VER_SEPARATOR,
181 /**************************************************
182 Begin initialization Python structures and objects
183 ***************************************************/
193 PyStdOut_dealloc(PyStdOut *self)
199 PyStdOut_write(PyStdOut *self, PyObject *args)
203 if (!PyArg_ParseTuple(args, "t#:write",&c, &l))
206 *(self->out)=*(self->out)+c;
212 static PyMethodDef PyStdOut_methods[] = {
213 {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
214 PyDoc_STR("write(string) -> None")},
215 {NULL, NULL} /* sentinel */
218 static PyMemberDef PyStdOut_memberlist[] = {
219 {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
220 (char*)"flag indicating that a space needs to be printed; used by print"},
221 {NULL} /* Sentinel */
224 static PyTypeObject PyStdOut_Type = {
225 /* The ob_type field must be initialized in the module init function
226 * to be portable to Windows without using C++. */
227 PyObject_HEAD_INIT(NULL)
230 sizeof(PyStdOut), /*tp_basicsize*/
233 (destructor)PyStdOut_dealloc, /*tp_dealloc*/
240 0, /*tp_as_sequence*/
245 PyObject_GenericGetAttr, /*tp_getattro*/
246 /* softspace is writable: we must supply tp_setattro */
247 PyObject_GenericSetAttr, /* tp_setattro */
249 Py_TPFLAGS_DEFAULT, /*tp_flags*/
253 0, /*tp_richcompare*/
254 0, /*tp_weaklistoffset*/
257 PyStdOut_methods, /*tp_methods*/
258 PyStdOut_memberlist, /*tp_members*/
272 PyObject * newPyStdOut( std::string& out )
274 PyStdOut* self = PyObject_New(PyStdOut, &PyStdOut_Type);
279 return (PyObject*)self;
283 /*************************************************
284 End initialization Python structures and objects
285 **************************************************/
289 // BEGIN EnforcedTreeWidgetDelegate
292 EnforcedTreeWidgetDelegate::EnforcedTreeWidgetDelegate(QObject *parent)
293 : QItemDelegate(parent)
297 QWidget *EnforcedTreeWidgetDelegate::createEditor(QWidget *parent,
298 const QStyleOptionViewItem & option ,
299 const QModelIndex & index ) const
301 QModelIndex father = index.parent();
302 QString entry = father.child(index.row(), ENF_VER_ENTRY_COLUMN).data(Qt::EditRole).toString();
304 if (index.column() == ENF_VER_X_COLUMN || \
305 index.column() == ENF_VER_Y_COLUMN || \
306 index.column() == ENF_VER_Z_COLUMN)
308 SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
309 editor->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
310 editor->setReadOnly(!entry.isEmpty());
311 editor->setDisabled(!entry.isEmpty());
316 QLineEdit *editor = new QLineEdit(parent);
317 if (index.column() != ENF_VER_GROUP_COLUMN) {
318 editor->setReadOnly(!entry.isEmpty());
319 editor->setDisabled(!entry.isEmpty());
325 void EnforcedTreeWidgetDelegate::setEditorData(QWidget *editor,
326 const QModelIndex &index) const
328 QString value = index.model()->data(index, Qt::EditRole).toString();
330 if (index.column() == ENF_VER_X_COLUMN ||
331 index.column() == ENF_VER_Y_COLUMN ||
332 index.column() == ENF_VER_Z_COLUMN)
334 SMESHGUI_SpinBox *lineEdit = static_cast<SMESHGUI_SpinBox*>(editor);
335 lineEdit->setText(value);
338 QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
339 lineEdit->setText(value);
343 void EnforcedTreeWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
344 const QModelIndex &index) const
346 QModelIndex parent = index.parent();
347 QString entry = parent.child(index.row(), ENF_VER_ENTRY_COLUMN).data(Qt::EditRole).toString();
348 if (index.column() == ENF_VER_X_COLUMN || index.column() == ENF_VER_Y_COLUMN || index.column() == ENF_VER_Z_COLUMN) {
349 SMESHGUI_SpinBox *lineEdit = static_cast<SMESHGUI_SpinBox*>(editor);
350 if (entry.isEmpty() && !vertexExists(model, index, lineEdit->GetString()))
351 model->setData(index, lineEdit->GetValue(), Qt::EditRole);
352 } else if (index.column() == ENF_VER_NAME_COLUMN) {
353 QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
354 QString value = lineEdit->text();
355 if (entry.isEmpty() && !vertexExists(model, index, value))
356 model->setData(index, value, Qt::EditRole);
357 } else if (index.column() == ENF_VER_ENTRY_COLUMN) {
358 QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
359 QString value = lineEdit->text();
360 if (!vertexExists(model, index, value))
361 model->setData(index, value, Qt::EditRole);
362 } else if (index.column() == ENF_VER_GROUP_COLUMN) {
363 QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
364 model->setData(index, lineEdit->text(), Qt::EditRole);
368 void EnforcedTreeWidgetDelegate::updateEditorGeometry(QWidget *editor,
369 const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
371 editor->setGeometry(option.rect);
374 bool EnforcedTreeWidgetDelegate::vertexExists(QAbstractItemModel *model,
375 const QModelIndex &index, QString value) const
378 QModelIndex parent = index.parent();
379 int row = index.row();
380 int col = index.column();
382 if (parent.isValid() && !value.isEmpty()) {
383 if (col == ENF_VER_X_COLUMN || col == ENF_VER_Y_COLUMN || col == ENF_VER_Z_COLUMN) {
385 if (col == ENF_VER_X_COLUMN) {
386 x = value.toDouble();
387 y = parent.child(row, ENF_VER_Y_COLUMN).data(Qt::EditRole).toDouble();
388 z = parent.child(row, ENF_VER_Z_COLUMN).data(Qt::EditRole).toDouble();
390 if (col == ENF_VER_Y_COLUMN) {
391 y = value.toDouble();
392 x = parent.child(row, ENF_VER_X_COLUMN).data(Qt::EditRole).toDouble();
393 z = parent.child(row, ENF_VER_Z_COLUMN).data(Qt::EditRole).toDouble();
395 if (col == ENF_VER_Z_COLUMN) {
396 z = value.toDouble();
397 x = parent.child(row, ENF_VER_X_COLUMN).data(Qt::EditRole).toDouble();
398 y = parent.child(row, ENF_VER_Y_COLUMN).data(Qt::EditRole).toDouble();
400 int nbChildren = model->rowCount(parent);
401 for (int i = 0 ; i < nbChildren ; i++) {
403 double childX = parent.child(i, ENF_VER_X_COLUMN).data(Qt::EditRole).toDouble();
404 double childY = parent.child(i, ENF_VER_Y_COLUMN).data(Qt::EditRole).toDouble();
405 double childZ = parent.child(i, ENF_VER_Z_COLUMN).data(Qt::EditRole).toDouble();
406 if ((childX == x) && (childY == y) && (childZ == z)) {
413 else if (col == ENF_VER_NAME_COLUMN) {
414 int nbChildren = model->rowCount(parent);
415 for (int i = 0 ; i < nbChildren ; i++) {
417 QString childName = parent.child(i, ENF_VER_NAME_COLUMN).data(Qt::EditRole).toString();
418 if (childName == value) {
431 // END EnforcedTreeWidgetDelegate
436 * \brief {BLSURFPluginGUI_HypothesisCreator constructor}
437 * @param theHypType Name of the hypothesis type (here BLSURF_Parameters)
440 BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QString& theHypType )
441 : SMESHGUI_GenericHypothesisCreator( theHypType )
443 this->mySMPMap.clear();
445 GeomToolSelected = NULL;
446 GeomToolSelected = getGeomSelectionTool();
448 aSel = GeomToolSelected->selectionMgr();
450 /* Initialize the Python interpreter */
451 if (! Py_IsInitialized())
452 throw ("Error: Python interpreter is not initialized");
453 PyGILState_STATE gstate;
454 gstate = PyGILState_Ensure();
457 main_mod = PyImport_AddModule("__main__");
460 main_dict = PyModule_GetDict(main_mod);
462 PyRun_SimpleString("from math import *");
463 PyGILState_Release(gstate);
467 BLSURFPluginGUI_HypothesisCreator::~BLSURFPluginGUI_HypothesisCreator()
472 * \brief {Get or create the geom selection tool for active study}
474 GeomSelectionTools* BLSURFPluginGUI_HypothesisCreator::getGeomSelectionTool() const
476 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
477 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
478 if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
479 that->GeomToolSelected = new GeomSelectionTools(aStudy);
481 return that->GeomToolSelected;
484 GEOM::GEOM_Gen_var BLSURFPluginGUI_HypothesisCreator::getGeomEngine()
486 return GeometryGUI::GetGeomGen();
489 void BLSURFPluginGUI_HypothesisCreator::avoidSimultaneousSelection(ListOfWidgets &selectionWidgets) const
491 StdMeshersGUI_ObjectReferenceParamWdg* widgetToActivate = 0;
492 ListOfWidgets::const_iterator anIt = selectionWidgets.begin();
493 for ( ; anIt != selectionWidgets.end(); anIt++)
495 if ( *anIt && (*anIt)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
497 StdMeshersGUI_ObjectReferenceParamWdg * w1 =
498 ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
499 ListOfWidgets::const_iterator anIt2 = anIt;
500 for ( ++anIt2; anIt2 != selectionWidgets.end(); anIt2++)
501 if ( *anIt2 && (*anIt2)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
503 StdMeshersGUI_ObjectReferenceParamWdg * w2 =
504 ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt2 );
505 w1->AvoidSimultaneousSelection( w2 );
507 if ( !widgetToActivate )
508 widgetToActivate = w1;
511 if ( widgetToActivate )
512 widgetToActivate->activateSelection();
515 bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
519 BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
520 BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
524 myAdvWidget->myOptionTable->setFocus();
525 QApplication::instance()->processEvents();
529 int iTbl = 0, nbTbl = myAdvWidget->myOptionTable->topLevelItemCount();
530 for ( ; iTbl < nbTbl; ++iTbl )
532 QTreeWidgetItem* table = myAdvWidget->myOptionTable->topLevelItem( iTbl );
533 int nbRows = table->childCount();
534 for ( int iRow = 0; iRow < nbRows; ++iRow )
536 QTreeWidgetItem* row = table->child( iRow );
537 myAdvWidget->GetOptionAndValue( row, name, value, isDefault );
539 if ( name.simplified().isEmpty() )
540 continue; // invalid custom option
542 if ( isDefault ) // not selected option
549 h->SetOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
552 h->SetPreCADOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
555 h->AddOption( name.toLatin1().constData(), value.toLatin1().constData() );
559 catch ( const SALOME::SALOME_Exception& ex )
561 msg = ex.details.text.in();
570 h->SetOptionValues( myOptions ); // restore values
571 h->SetPreCADOptionValues( myPreCADOptions ); // restore values
575 // SizeMap and attractors
578 mySizeMapTable->setFocus();
579 QApplication::instance()->processEvents();
581 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
582 int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
584 for ( ; row < nbRows; ++row )
586 QString entry = mySizeMapTable->topLevelItem( row )->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
587 QString sizeMap = mySizeMapTable->topLevelItem( row )->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
588 if ( !sizeMap.isEmpty() ) {
589 if (that->sizeMapValidationFromRow(row))
592 e = entry.toStdString();
593 s = that->mySMPMap[entry].toStdString();
594 h->SetSizeMapEntry( e.c_str(), s.c_str() );
596 catch ( const SALOME::SALOME_Exception& ex )
598 msg = ex.details.text.in();
609 // 22207: BLSURFPLUGIN: The user is allowed to enter 0 as a global or local size.
612 // In case if not STD_TAB is current tab, then text() of empty spinboxes returns "0" value.
613 // So STD_TAB must be current tab to get correct value of it's spinbox.
614 myTabWidget->setCurrentIndex( STD_TAB );
618 if ( !( ok = ( myStdWidget->myPhySize->text().isEmpty() ||
619 myStdWidget->myPhySize->text().toDouble() > 0.0 )))
620 msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_HPHYDEF"));
624 if ( !( ok = ( myStdWidget->myMaxSize->text().isEmpty() ||
625 myStdWidget->myMaxSize->text().toDouble() > 0.0 )))
626 msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_MAXSIZE"));
630 if ( !( ok = ( myStdWidget->myAngleMesh->text().isEmpty() ||
631 myStdWidget->myAngleMesh->text().toDouble() > 0.0 )))
632 msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_ANGLE_MESH"));
636 if ( !( ok = ( myStdWidget->myChordalError->text().isEmpty() ||
637 myStdWidget->myChordalError->text().toDouble() > 0.0 )))
638 msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_CHORDAL_ERROR"));
647 QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
649 QFrame* fr = new QFrame( 0 );
650 QVBoxLayout* lay = new QVBoxLayout( fr );
652 lay->setSpacing( 0 );
654 // main TabWidget of the dialog
655 myTabWidget = new QTabWidget( fr );
656 myTabWidget->setTabShape( QTabWidget::Rounded );
657 myTabWidget->setTabPosition( QTabWidget::North );
658 lay->addWidget( myTabWidget );
663 myStdGroup = new QWidget();
664 QGridLayout* aStdLayout = new QGridLayout( myStdGroup );
665 aStdLayout->setSpacing( 6 );
666 aStdLayout->setMargin( 11 );
669 myName = new QLineEdit( myStdGroup );
670 myStdWidget = new BLSURFPluginGUI_StdWidget(myStdGroup);
674 aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), 0, 0, 1, 1 );
675 aStdLayout->addWidget( myName, row++, 1, 1, 3 );
677 aStdLayout->addWidget( myStdWidget, row++, 0, 1, 4 );
682 aStdLayout->setRowStretch(row,1);
683 aStdLayout->setColumnStretch(1,1);
686 // advanced parameters
687 myAdvGroup = new QWidget();
688 QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup );
689 anAdvLayout->setSpacing( 6 );
690 anAdvLayout->setMargin( 11 );
691 myAdvWidget = new BLSURFPluginGUI_AdvWidget(myAdvGroup);
692 anAdvLayout->addWidget( myAdvWidget );
695 // Size Maps parameters
697 mySmpGroup = new QWidget();
700 QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
703 mySizeMapTable = new QTreeWidget( mySmpGroup );
704 mySizeMapTable ->setMinimumWidth(200);
705 QStringList sizeMapHeaders;
706 sizeMapHeaders << tr( "SMP_NAME_COLUMN" )<< tr( "SMP_SIZEMAP_COLUMN" )<< tr( "SMP_ENTRY_COLUMN" );// << tr( "SMP_DIST_COLUMN" );
707 mySizeMapTable->setHeaderLabels(sizeMapHeaders);
708 mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN);
709 mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
710 mySizeMapTable->hideColumn(SMP_ENTRY_COLUMN);
711 mySizeMapTable->setAlternatingRowColors(true);
714 smpTab = new QTabWidget( mySmpGroup );
715 smpTab->setTabShape( QTabWidget::Rounded );
716 smpTab->setTabPosition( QTabWidget::South );
717 lay->addWidget( smpTab );
719 // Filters of selection
720 TColStd_MapOfInteger SM_ShapeTypes, ATT_ShapeTypes;
722 SM_ShapeTypes.Add( TopAbs_VERTEX );
723 SM_ShapeTypes.Add( TopAbs_EDGE );
724 SM_ShapeTypes.Add( TopAbs_FACE );
725 SM_ShapeTypes.Add( TopAbs_COMPOUND );
727 ATT_ShapeTypes.Add( TopAbs_VERTEX );
728 ATT_ShapeTypes.Add( TopAbs_EDGE );
729 ATT_ShapeTypes.Add( TopAbs_WIRE );
730 ATT_ShapeTypes.Add( TopAbs_COMPOUND );
732 SMESH_NumberFilter* myFilter1 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, SM_ShapeTypes);
733 SMESH_NumberFilter* myFilter2 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, ATT_ShapeTypes);
734 SMESH_NumberFilter* myFilter3 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, TopAbs_FACE);
736 // Standard size map tab
737 mySmpStdGroup = new QWidget();
738 QGridLayout* anSmpStdLayout = new QGridLayout(mySmpStdGroup);
739 myGeomSelWdg1 = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter1, 0, /*multiSel=*/false);
740 myGeomSelWdg1->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
741 mySmpSizeSpin = new SMESHGUI_SpinBox(mySmpStdGroup);
742 mySmpSizeSpin->RangeStepAndValidator(0., COORD_MAX, 1.0, "length_precision");
743 QLabel* mySmpSizeLabel = new QLabel(tr("BLSURF_SM_SIZE"),mySmpStdGroup);
746 myAttractorGroup = new QWidget();
747 QGridLayout* anAttLayout = new QGridLayout(myAttractorGroup);
748 myGeomSelWdg2 = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter3, 0, /*multiSel=*/false);
749 myGeomSelWdg2->SetDefaultText(tr("BLS_SEL_FACE"), "QLineEdit { color: grey }");
750 myGeomSelWdg2->AvoidSimultaneousSelection(myGeomSelWdg1);
751 myAttractorCheck = new QCheckBox(tr("BLSURF_ATTRACTOR"),myAttractorGroup);
752 myConstSizeCheck = new QCheckBox(tr("BLSURF_CONST_SIZE"),myAttractorGroup);
753 QFrame* attLine = new QFrame(myAttractorGroup);
754 attLine->setFrameShape(QFrame::HLine);
755 attLine->setFrameShadow(QFrame::Sunken);
756 myAttSelWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter2, myAttractorGroup, /*multiSel=*/false);
757 myAttSelWdg->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }");
758 myAttSizeSpin = new SMESHGUI_SpinBox(myAttractorGroup);
759 myAttSizeSpin->RangeStepAndValidator(0., COORD_MAX, 1.0, "length_precision");
760 myAttSizeLabel = new QLabel(tr("BLSURF_SM_SIZE"),myAttractorGroup);
761 myAttDistSpin = new SMESHGUI_SpinBox(myAttractorGroup);
762 myAttDistSpin->RangeStepAndValidator(0., COORD_MAX, 10.0, "length_precision");
763 myAttDistLabel = new QLabel(tr("BLSURF_ATT_DIST"),myAttractorGroup);
764 myAttDistSpin2 = new SMESHGUI_SpinBox(myAttractorGroup);
765 myAttDistSpin2->RangeStepAndValidator(0., COORD_MAX, 1.0, "length_precision");
766 myAttDistLabel2 = new QLabel(tr("BLSURF_ATT_RADIUS"),myAttractorGroup);
768 myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg1);
769 myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg2);
773 addMapButton = new QPushButton(tr("BLSURF_SM_ADD"),mySmpGroup);
774 removeMapButton = new QPushButton(tr("BLSURF_SM_REMOVE"),mySmpGroup);
775 modifyMapButton = new QPushButton(tr("BLSURF_SM_MODIFY"),mySmpGroup);
776 modifyMapButton->setEnabled(false);
779 myAttSelWdg->setEnabled(false);
780 myAttSizeSpin->setEnabled(false);
781 myAttSizeLabel->setEnabled(false);
782 myAttDistSpin->setEnabled(false);
783 myAttDistLabel->setEnabled(false);
784 myAttDistSpin2->setEnabled(false);
785 myAttDistLabel2->setEnabled(false);
786 myAttDistSpin->setValue(0.);
787 myAttDistSpin2->setValue(0.);
788 myAttSizeSpin->setValue(0.);
789 mySmpSizeSpin->setValue(0.);
792 // ADD WIDGETS (SIZEMAP TAB)
793 anSmpLayout->addWidget(mySizeMapTable, 0, 0, SMP_NB_LINES, 1);
794 anSmpLayout->setColumnStretch(0, 1);
795 // anSmpLayout->addWidget(line2, SMP_SEPARATOR2, 1, 2, 2);
796 anSmpLayout->addWidget(smpTab, SMP_TAB_WDG, 1, 1, 3);
797 anSmpLayout->setRowStretch(SMP_TAB_WDG, 1);
798 anSmpLayout->addWidget(addMapButton, SMP_ADD_BTN, 1, 1, 1);
799 anSmpLayout->addWidget(removeMapButton, SMP_ADD_BTN, 2, 1, 1);
800 anSmpLayout->addWidget(modifyMapButton, SMP_ADD_BTN, 3, 1, 1);
803 anSmpStdLayout->addWidget(myGeomSelWdg1, SMP_GEOM_BTN_1, 1, 1, 2);
804 anSmpStdLayout->addWidget(mySmpSizeLabel, SMP_SIZE, 1, 1, 1);
805 anSmpStdLayout->addWidget(mySmpSizeSpin, SMP_SIZE, 2, 1, 1);
806 anSmpStdLayout->setRowStretch(SMP_SPACE2, 1);
809 anAttLayout->addWidget(myGeomSelWdg2, SMP_GEOM_BTN_2, 1, 1, 2);
810 anAttLayout->addWidget(myAttractorCheck, ATT_CHECK, 1, 1, 2);
811 anAttLayout->addWidget(myConstSizeCheck, CONST_SIZE_CHECK,1, 1, 2);
812 anAttLayout->addWidget(attLine, SMP_SPACE, 1, 1, 2);
813 anAttLayout->addWidget(myAttSelWdg, SMP_ATT_SHAPE, 1, 1, 2);
814 anAttLayout->addWidget(myAttSizeLabel, SMP_ATT_SIZE, 1, 1, 1);
815 anAttLayout->addWidget(myAttSizeSpin, SMP_ATT_SIZE, 2, 1, 1);
816 anAttLayout->addWidget(myAttDistLabel, SMP_ATT_DIST, 1, 1, 1);
817 anAttLayout->addWidget(myAttDistSpin, SMP_ATT_DIST, 2, 1, 1);
818 anAttLayout->addWidget(myAttDistLabel2, SMP_ATT_RAD, 1, 1, 1);
819 anAttLayout->addWidget(myAttDistSpin2, SMP_ATT_RAD, 2, 1, 1);
820 anAttLayout->setRowStretch(SMP_ATT_RAD+1, 1);
822 smpTab->insertTab( SMP_STD_TAB, mySmpStdGroup, tr( "BLSURF_SM_STD_TAB" ) );
823 smpTab->insertTab( ATT_TAB, myAttractorGroup, tr( "BLSURF_SM_ATT_TAB" ) );
825 smpTab->setCurrentIndex( SMP_STD_TAB );
827 // Enforced vertices parameters
828 myEnfGroup = new QWidget();
829 QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
831 myEnforcedTreeWidget = new QTreeWidget(myEnfGroup);
832 myEnforcedTreeWidget->setColumnCount( ENF_VER_NB_COLUMNS );
833 myEnforcedTreeWidget->setSortingEnabled(true);
834 QStringList enforcedHeaders;
835 enforcedHeaders << tr("BLSURF_ENF_VER_NAME_COLUMN") << tr("BLSURF_ENF_VER_FACE_ENTRY_COLUMN")
836 << tr("BLSURF_ENF_VER_X_COLUMN")<< tr("BLSURF_ENF_VER_Y_COLUMN") << tr("BLSURF_ENF_VER_Z_COLUMN")
837 << tr("BLSURF_ENF_VER_ENTRY_COLUMN") << tr( "BLSURF_ENF_VER_GROUP_COLUMN" );
839 myEnforcedTreeWidget->setHeaderLabels(enforcedHeaders);
840 myEnforcedTreeWidget->header()->setStretchLastSection(true);
841 myEnforcedTreeWidget->setAlternatingRowColors(true);
842 myEnforcedTreeWidget->setUniformRowHeights(true);
843 myEnforcedTreeWidget->setAnimated(true);
844 myEnforcedTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
845 myEnforcedTreeWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
846 for (int column = 0; column < ENF_VER_NB_COLUMNS; ++column) {
847 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
848 myEnforcedTreeWidget->header()->setResizeMode(column,QHeaderView::Interactive);
850 myEnforcedTreeWidget->header()->setSectionResizeMode(column,QHeaderView::Interactive);
852 myEnforcedTreeWidget->resizeColumnToContents(column);
854 myEnforcedTreeWidget->hideColumn(ENF_VER_FACE_ENTRY_COLUMN);
855 myEnforcedTreeWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
856 myEnforcedTreeWidget->setItemDelegate(new EnforcedTreeWidgetDelegate());
858 // FACE AND VERTEX SELECTION
859 TColStd_MapOfInteger shapeTypes1, shapeTypes2;
860 shapeTypes1.Add( TopAbs_FACE );
861 shapeTypes1.Add( TopAbs_COMPOUND );
862 shapeTypes2.Add( TopAbs_VERTEX );
863 shapeTypes2.Add( TopAbs_COMPOUND );
865 // SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1);
866 // myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true);
867 // myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }");
869 SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes2);
870 myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
871 myEnfVertexWdg->SetDefaultText(tr("BLS_SEL_VERTICES"), "QLineEdit { color: grey }");
873 //myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg);
875 QLabel* myXCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_X_LABEL" ), myEnfGroup );
876 myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
877 myXCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
879 QLabel* myYCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_Y_LABEL" ), myEnfGroup );
880 myYCoord = new SMESHGUI_SpinBox(myEnfGroup);
881 myYCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
883 QLabel* myZCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_Z_LABEL" ), myEnfGroup );
884 myZCoord = new SMESHGUI_SpinBox(myEnfGroup);
885 myZCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
887 QLabel* myGroupNameLabel = new QLabel( tr( "BLSURF_ENF_VER_GROUP_LABEL" ), myEnfGroup );
888 myGroupName = new QLineEdit(myEnfGroup);
890 addVertexButton = new QPushButton(tr("BLSURF_ENF_VER_VERTEX"),myEnfGroup);
891 removeVertexButton = new QPushButton(tr("BLSURF_ENF_VER_REMOVE"),myEnfGroup);
893 myInternalEnforcedVerticesAllFaces = new QCheckBox(tr("BLSURF_ENF_VER_INTERNAL_VERTICES"),myEnfGroup);
895 QLabel* myInternalEnforcedVerticesAllFacesGroupLabel = new QLabel( tr( "BLSURF_ENF_VER_GROUP_LABEL" ), myEnfGroup );
896 myInternalEnforcedVerticesAllFacesGroup = new QLineEdit(myEnfGroup);
898 anEnfLayout->addWidget(myEnforcedTreeWidget, 0, 0, ENF_VER_NB_LINES, 1);
899 QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
900 // FACE AND VERTEX SELECTION
901 //anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2);
902 anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
903 anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
904 anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
905 anEnfLayout2->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 0, 1, 1);
906 anEnfLayout2->addWidget(myYCoord, ENF_VER_Y_COORD, 1, 1, 1);
907 anEnfLayout2->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 0, 1, 1);
908 anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1);
909 anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1);
910 anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1);
911 anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
912 anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
913 anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFaces, ENF_VER_INTERNAL_ALL_FACES, 0, 1, 2);
914 anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroupLabel, ENF_VER_INTERNAL_ALL_FACES_GROUP, 0, 1, 1);
915 anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroup, ENF_VER_INTERNAL_ALL_FACES_GROUP, 1, 1, 1);
916 anEnfLayout2->setRowStretch(ENF_VER_NB_LINES+1, 1);
917 anEnfLayout->addLayout(anEnfLayout2, 0,1,ENF_VER_NB_LINES+1,2);
920 // Periodicity parameters
921 myPeriodicityGroup = new QWidget();
922 aPeriodicityLayout1 = new QGridLayout(myPeriodicityGroup);
924 myPeriodicitySplitter = new QSplitter(myPeriodicityGroup);
925 myPeriodicitySplitter->setOrientation(Qt::Horizontal);
926 aPeriodicityLayout1->addWidget(myPeriodicitySplitter, 0, 0, 1, 1);
928 myPeriodicityTreeWidget = new QTreeWidget(myPeriodicitySplitter);
930 QStringList myPeriodicityTreeHeaders;
931 myPeriodicityTreeHeaders << tr("BLSURF_PERIODICITY_OBJ_SOURCE_COLUMN")
932 << tr("BLSURF_PERIODICITY_OBJ_TARGET_COLUMN")
933 << tr("BLSURF_PERIODICITY_P1_SOURCE_COLUMN")
934 << tr("BLSURF_PERIODICITY_P2_SOURCE_COLUMN")
935 << tr("BLSURF_PERIODICITY_P3_SOURCE_COLUMN")
936 << tr("BLSURF_PERIODICITY_P1_TARGET_COLUMN")
937 << tr("BLSURF_PERIODICITY_P2_TARGET_COLUMN")
938 << tr("BLSURF_PERIODICITY_P3_TARGET_COLUMN")
939 << tr("BLSURF_PERIODICITY_SHAPE_TYPE");
940 myPeriodicityTreeWidget->setHeaderLabels(myPeriodicityTreeHeaders);
942 // Hide the vertex name to make the widget more readable
943 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P1_SOURCE_COLUMN);
944 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P2_SOURCE_COLUMN);
945 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P3_SOURCE_COLUMN);
946 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P1_TARGET_COLUMN);
947 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P2_TARGET_COLUMN);
948 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P3_TARGET_COLUMN);
949 myPeriodicityTreeWidget->hideColumn(PERIODICITY_SHAPE_TYPE);
952 myPeriodicityTreeWidget->setColumnCount(PERIODICITY_NB_COLUMN);
953 myPeriodicityTreeWidget->setSortingEnabled(true);
955 myPeriodicityTreeWidget->setAlternatingRowColors(true);
956 myPeriodicityTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
957 myPeriodicityTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
959 size_t periodicityVisibleColumns = 2;
960 for (size_t column = 0; column < periodicityVisibleColumns; ++column) {
961 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
962 myPeriodicityTreeWidget->header()->setResizeMode(column,QHeaderView::Interactive);
964 myPeriodicityTreeWidget->header()->setSectionResizeMode(column,QHeaderView::Interactive);
966 myPeriodicityTreeWidget->resizeColumnToContents(column);
968 myPeriodicityTreeWidget->header()->setStretchLastSection(true);
970 myPeriodicitySplitter->addWidget(myPeriodicityTreeWidget);
972 myPeriodicityRightWidget = new QWidget(myPeriodicitySplitter);
974 myPeriodicityRightGridLayout = new QGridLayout(myPeriodicityRightWidget);
975 myPeriodicityGroupBox1 = new QGroupBox(tr("BLSURF_PRECAD_PERIODICITY"), myPeriodicityRightWidget);
976 myPeriodicityGroupBox1Layout = new QGridLayout(myPeriodicityGroupBox1);
978 myPeriodicityRightGridLayout->addWidget(myPeriodicityGroupBox1, 0, 0, 1, 2);
980 myPeriodicityOnFaceRadioButton = new QRadioButton(tr("BLSURF_PERIODICITY_ON_FACE"), myPeriodicityGroupBox1);
981 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityOnFaceRadioButton, 0, 0, 1, 2);
983 myPeriodicityOnFaceRadioButton->setChecked(true);
985 myPeriodicityOnEdgeRadioButton = new QRadioButton(tr("BLSURF_PERIODICITY_ON_EDGE"), myPeriodicityGroupBox1);
986 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityOnEdgeRadioButton, 0, 2, 1, 2);
989 // FACE, EDGE AND VERTEX SELECTION
990 TColStd_MapOfInteger shapeTypesFace, shapeTypesEdge;
991 shapeTypesFace.Add( TopAbs_FACE );
992 shapeTypesFace.Add( TopAbs_EDGE );
993 shapeTypesFace.Add( TopAbs_COMPOUND );
994 shapeTypesEdge.Add( TopAbs_EDGE );
995 shapeTypesEdge.Add( TopAbs_COMPOUND );
997 // myPeriodicityEdgeFilter = new SMESH_NumberFilter("GEOM", TopAbs_EDGE, 0, shapeTypesEdge);
999 myPeriodicityMainSourceLabel = new QLabel(tr("BLSURF_PERIODICITY_MAIN_SOURCE"), myPeriodicityGroupBox1);
1000 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityMainSourceLabel, 1, 0, 1, 1);
1002 SMESH_NumberFilter* myPeriodicitySourceFaceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, shapeTypesFace);
1003 myPeriodicitySourceFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicitySourceFaceFilter, 0, /*multiSel=*/false);
1004 // myPeriodicitySourceFaceWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_FACE"), "QLineEdit { color: grey }");
1005 myPeriodicityGroupBox1Layout->addWidget(myPeriodicitySourceFaceWdg, 1, 1, 1, 1);
1007 // myPeriodicitySourceEdgeWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityEdgeFilter, 0, /*multiSel=*/false);
1008 // myPeriodicitySourceEdgeWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_EDGE"), "QLineEdit { color: grey }");
1009 // myPeriodicitySourceEdgeWdg->hide();
1010 // myPeriodicityGroupBox1Layout->addWidget(myPeriodicitySourceEdgeWdg, 1, 1, 1, 1);
1012 myPeriodicityMainTargetLabel = new QLabel(tr("BLSURF_PERIODICITY_MAIN_TARGET"), myPeriodicityGroupBox1);
1013 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityMainTargetLabel, 1, 2, 1, 1);
1015 SMESH_NumberFilter* myPeriodicityTargetFaceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, shapeTypesFace);
1016 myPeriodicityTargetFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityTargetFaceFilter, 0, /*multiSel=*/false);
1017 // myPeriodicityTargetFaceWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_FACE"), "QLineEdit { color: grey }");
1018 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityTargetFaceWdg, 1, 3, 1, 1);
1020 // myPeriodicityTargetEdgeWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityEdgeFilter, 0, /*multiSel=*/false);
1021 // myPeriodicityTargetEdgeWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_EDGE"), "QLineEdit { color: grey }");
1022 // myPeriodicityTargetEdgeWdg->hide();
1023 // myPeriodicityGroupBox1Layout->addWidget(myPeriodicityTargetEdgeWdg, 1, 3, 1, 1);
1025 myPeriodicityGroupBox2 = new QGroupBox(tr("BLSURF_PERIODICITY_WITH_VERTICES"), myPeriodicityRightWidget);
1026 myPeriodicityGroupBox2Layout = new QGridLayout(myPeriodicityGroupBox2);
1027 myPeriodicityRightGridLayout->addWidget(myPeriodicityGroupBox2, 1, 0, 1, 2);
1029 myPeriodicityGroupBox2->setCheckable(true);
1030 myPeriodicityGroupBox2->setChecked(false);
1032 myPeriodicitySourceLabel = new QLabel(tr("BLSURF_PERIODICITY_SOURCE"), myPeriodicityGroupBox2);
1033 myPeriodicityGroupBox2Layout->addWidget(myPeriodicitySourceLabel, 0, 0, 1, 2);
1035 myPeriodicityTargetLabel = new QLabel(tr("BLSURF_PERIODICITY_TARGET"), myPeriodicityGroupBox2);
1036 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityTargetLabel, 0, 2, 1, 2);
1039 myPeriodicityP1SourceLabel = new QLabel(tr("BLSURF_PERIODICITY_P1_SOURCE"), myPeriodicityGroupBox2);
1040 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1SourceLabel, 1, 0, 1, 1);
1043 SMESH_NumberFilter* myPeriodicityP1SourceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1044 myPeriodicityP1SourceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP1SourceFilter, 0, /*multiSel=*/false);
1045 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1SourceWdg, 1, 1, 1, 1);
1048 myPeriodicityP2SourceLabel = new QLabel(tr("BLSURF_PERIODICITY_P2_SOURCE"), myPeriodicityGroupBox2);
1049 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2SourceLabel, 2, 0, 1, 1);
1051 SMESH_NumberFilter* myPeriodicityP2SourceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1052 myPeriodicityP2SourceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP2SourceFilter, 0, /*multiSel=*/false);
1053 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2SourceWdg, 2, 1, 1, 1);
1056 myPeriodicityP3SourceLabel = new QLabel(tr("BLSURF_PERIODICITY_P3_SOURCE"), myPeriodicityGroupBox2);
1057 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3SourceLabel, 3, 0, 1, 1);
1059 SMESH_NumberFilter* myPeriodicityP3SourceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1060 myPeriodicityP3SourceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP3SourceFilter, 0, /*multiSel=*/false);
1061 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3SourceWdg, 3, 1, 1, 1);
1064 myPeriodicityP1TargetLabel = new QLabel(tr("BLSURF_PERIODICITY_P1_TARGET"), myPeriodicityGroupBox2);
1065 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1TargetLabel, 1, 2, 1, 1);
1067 SMESH_NumberFilter* myPeriodicityP1TargetFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1068 myPeriodicityP1TargetWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP1TargetFilter, 0, /*multiSel=*/false);
1069 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1TargetWdg, 1, 3, 1, 1);
1072 myPeriodicityP2TargetLabel = new QLabel(tr("BLSURF_PERIODICITY_P2_TARGET"), myPeriodicityGroupBox2);
1073 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2TargetLabel, 2, 2, 1, 1);
1075 SMESH_NumberFilter* myPeriodicityP2TargetFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1076 myPeriodicityP2TargetWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP2TargetFilter, 0, /*multiSel=*/false);
1077 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2TargetWdg, 2, 3, 1, 1);
1080 myPeriodicityP3TargetLabel = new QLabel(tr("BLSURF_PERIODICITY_P3_TARGET"), myPeriodicityGroupBox2);
1081 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3TargetLabel, 3, 2, 1, 1);
1083 SMESH_NumberFilter* myPeriodicityP3TargetFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1084 myPeriodicityP3TargetWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP3TargetFilter, 0, /*multiSel=*/false);
1085 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3TargetWdg, 3, 3, 1, 1);
1087 myPeriodicityVerticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
1088 myPeriodicityGroupBox2Layout->addItem(myPeriodicityVerticalSpacer, 7, 1, 1, 1);
1091 myPeriodicityAddButton = new QPushButton(tr("BLSURF_PERIODICITY_ADD"),myPeriodicityRightWidget);
1092 myPeriodicityRightGridLayout->addWidget(myPeriodicityAddButton, 2, 0, 1, 1);
1094 myPeriodicityRemoveButton = new QPushButton(tr("BLSURF_PERIODICITY_REMOVE"),myPeriodicityRightWidget);
1095 myPeriodicityRightGridLayout->addWidget(myPeriodicityRemoveButton, 2, 1, 1, 1);
1097 myPeriodicitySplitter->addWidget(myPeriodicityRightWidget);
1099 myPeriodicitySelectionWidgets.clear();
1100 myPeriodicitySelectionWidgets.append(myPeriodicitySourceFaceWdg);
1101 myPeriodicitySelectionWidgets.append(myPeriodicityTargetFaceWdg);
1102 myPeriodicitySelectionWidgets.append(myPeriodicityP1SourceWdg);
1103 myPeriodicitySelectionWidgets.append(myPeriodicityP2SourceWdg);
1104 myPeriodicitySelectionWidgets.append(myPeriodicityP3SourceWdg);
1105 myPeriodicitySelectionWidgets.append(myPeriodicityP1TargetWdg);
1106 myPeriodicitySelectionWidgets.append(myPeriodicityP2TargetWdg);
1107 myPeriodicitySelectionWidgets.append(myPeriodicityP3TargetWdg);
1108 avoidSimultaneousSelection(myPeriodicitySelectionWidgets);
1110 // HyperPatch parameters
1112 QWidget* hpGroup = new QWidget();
1113 QGridLayout* hpLayout = new QGridLayout(hpGroup);
1115 myHyPatchTable = new QTableWidget( hpGroup );
1116 myHyPatchTable->setColumnCount(1);
1117 myHyPatchTable->setHorizontalHeaderLabels( QStringList() << tr("BLSURF_HYPATCH_TBL_HEADER") );
1118 myHyPatchTable->setAlternatingRowColors(true);
1119 myHyPatchTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
1122 QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
1123 myHyPatchFaceSelBtn = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_FACE"), hpGroup );
1124 myHyPatchGroupSelBtn = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_GROUP"), hpGroup );
1125 myHyPatchFaceSelBtn->setCheckable( true );
1126 myHyPatchGroupSelBtn->setCheckable( true );
1128 myHyPatchFaceSelector = new StdMeshersGUI_SubShapeSelectorWdg( hpGroup, TopAbs_FACE, /*toShowList=*/false );
1130 QLabel* hpTagsLbl = new QLabel( tr("BLSURF_TAGS"), hpGroup );
1131 myHyPatchTagsLE = new QLineEdit( hpGroup );
1132 myHyPatchTagsLE->setValidator( new SMESHGUI_IdValidator( hpGroup ));
1134 QPushButton* hpAddBtn = new QPushButton( tr("BLSURF_SM_ADD"), hpGroup );
1135 QPushButton* hpRemBtn = new QPushButton( tr("BLSURF_SM_REMOVE"), hpGroup );
1137 hpLayout->addWidget( myHyPatchTable, 0, 0, 5, 1 );
1138 hpLayout->addWidget( myHyPatchFaceSelBtn, 0, 1, 1, 2 );
1139 hpLayout->addWidget( myHyPatchGroupSelBtn, 0, 3, 1, 2 );
1140 hpLayout->addWidget( hpTagsLbl, 1, 1, 1, 1 );
1141 hpLayout->addWidget( myHyPatchTagsLE, 1, 2, 1, 3 );
1142 hpLayout->addWidget( hpAddBtn, 2, 1, 1, 2 );
1143 hpLayout->addWidget( hpRemBtn, 2, 3, 1, 2 );
1144 hpLayout->addWidget( myHyPatchFaceSelector, 3, 1, 1, 4 );
1147 myTabWidget->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
1148 myTabWidget->insertTab( ADV_TAB, myAdvGroup, tr( "BLSURF_ADV_ARGS" ) );
1149 myTabWidget->insertTab( SMP_TAB, mySmpGroup, tr( "LOCAL_SIZE" ) );
1150 myTabWidget->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) );
1151 myTabWidget->insertTab( PERIODICITY_TAB, myPeriodicityGroup, tr( "BLSURF_PERIODICITY" ) );
1152 myTabWidget->insertTab( HYPERPATCH_TAB, hpGroup, tr( "BLSURF_HYPERPATCH_TAB" ));
1154 myTabWidget->setCurrentIndex( STD_TAB );
1156 connect( myAdvWidget->addBtn, SIGNAL( clicked() ), this, SLOT( onAddOption() ) );
1157 connect( myStdWidget->myAllowQuadrangles, SIGNAL( stateChanged( int ) ), this, SLOT( onStateChange() ));
1160 connect( addMapButton, SIGNAL( clicked()), this, SLOT( onAddMap() ) );
1161 connect( removeMapButton, SIGNAL( clicked()), this, SLOT( onRemoveMap() ) );
1162 connect( modifyMapButton, SIGNAL( clicked()), this, SLOT( onModifyMap() ) );
1163 connect( mySizeMapTable, SIGNAL( itemClicked (QTreeWidgetItem *, int)),this, SLOT( onSmpItemClicked(QTreeWidgetItem *, int) ) );
1164 connect( myGeomSelWdg2, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
1165 connect( myGeomSelWdg1, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
1166 connect( myAttSelWdg, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
1167 connect( mySizeMapTable, SIGNAL( itemChanged (QTreeWidgetItem *, int)),this, SLOT( onSetSizeMap(QTreeWidgetItem *, int) ) );
1168 connect( myAttractorCheck, SIGNAL( stateChanged ( int )), this, SLOT( onAttractorClicked( int ) ) );
1169 connect( myConstSizeCheck, SIGNAL( stateChanged ( int )), this, SLOT( onConstSizeClicked( int ) ) );
1170 connect( smpTab, SIGNAL( currentChanged ( int )), this, SLOT( onTabChanged( int ) ) );
1171 connect( myTabWidget, SIGNAL( currentChanged ( int )), this, SLOT( onTabChanged( int ) ) );
1173 // Enforced vertices
1174 connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this, SLOT( synchronizeCoords() ) );
1175 connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( updateEnforcedVertexValues(QTreeWidgetItem *, int) ) );
1176 connect( myEnforcedTreeWidget,SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
1177 connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertices() ) );
1178 connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
1179 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
1180 connect( myInternalEnforcedVerticesAllFaces, SIGNAL( stateChanged ( int )), this, SLOT( onInternalVerticesClicked( int ) ) );
1183 connect( myPeriodicityAddButton, SIGNAL( clicked()), this, SLOT( onAddPeriodicity() ) );
1184 connect( myPeriodicityRemoveButton, SIGNAL( clicked()), this, SLOT( onRemovePeriodicity() ) );
1185 connect( myPeriodicityTreeWidget, SIGNAL( itemClicked(QTreeWidgetItem*, int)), this, SLOT( onPeriodicityTreeClicked(QTreeWidgetItem *, int) ) );
1186 connect( myPeriodicityGroupBox2, SIGNAL(toggled(bool)), this, SLOT(onPeriodicityByVerticesChecked(bool)));
1188 ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
1189 for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++)
1191 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1192 connect( w1, SIGNAL(contentModified ()), this, SLOT(onPeriodicityContentModified()));
1197 connect( myHyPatchFaceSelBtn, SIGNAL( toggled(bool) ), SLOT( onHyPatchFaceSelection(bool) ));
1198 connect( myHyPatchGroupSelBtn, SIGNAL( toggled(bool) ), SLOT( onHyPatchGroupSelection(bool) ));
1199 connect( myHyPatchFaceSelector, SIGNAL( shapeSelected() ), SLOT( onHyPatchSelectionChanged()));
1200 connect( hpAddBtn, SIGNAL( clicked() ), SLOT( onHyPatchAdd()));
1201 connect( hpRemBtn, SIGNAL( clicked() ), SLOT( onHyPatchRemove()));
1206 /** BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget*, QWidget*)
1207 This method stop the selection of the widgets StdMeshersGUI_ObjectReferenceParamWdg
1209 // void BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget* old, QWidget* now)
1211 // if ((now == myXCoord) || (now == myYCoord) || (now == myZCoord)
1212 // || (now = myGroupName) || (now = myGlobalGroupName) || (now = myEnforcedTreeWidget)) {
1213 // BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1214 // that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1215 // myEnfFaceWdg->deactivateSelection();
1216 // myEnfVertexWdg->deactivateSelection();
1220 void BLSURFPluginGUI_HypothesisCreator::onStateChange()
1222 myStdWidget->onPhysicalMeshChanged();
1226 * This method resets the content of the X, Y, Z widgets;
1228 void BLSURFPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
1230 myXCoord->setCleared(true);
1231 myYCoord->setCleared(true);
1232 myZCoord->setCleared(true);
1233 myXCoord->setText("");
1234 myYCoord->setText("");
1235 myZCoord->setText("");
1236 // myGroupName->setText("");
1239 /** BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item, column)
1240 This method updates the tooltip of a modified item. The QLineEdit widgets content
1241 is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
1243 void BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTreeWidgetItem* item, int column) {
1244 QVariant vertexName = item->data(ENF_VER_NAME_COLUMN, Qt::EditRole);
1245 QVariant x = item->data(ENF_VER_X_COLUMN, Qt::EditRole);
1246 QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole);
1247 QVariant z = item->data(ENF_VER_Z_COLUMN, Qt::EditRole);
1248 QVariant entry = item->data(ENF_VER_ENTRY_COLUMN, Qt::EditRole);
1249 QString groupName = item->data(ENF_VER_GROUP_COLUMN, Qt::EditRole).toString();
1250 QTreeWidgetItem* parent = item->parent();
1252 clearEnforcedVertexWidgets();
1254 if (parent && (!x.isNull() || !entry.isNull())) {
1255 QString shapeName = parent->data(ENF_VER_NAME_COLUMN, Qt::EditRole).toString();
1256 QString toolTip = shapeName + QString(": ") + vertexName.toString();
1257 if (entry.isNull()) {
1258 toolTip += QString("(") + x.toString();
1259 toolTip += QString(", ") + y.toString();
1260 toolTip += QString(", ") + z.toString();
1261 toolTip += QString(")");
1264 if (!groupName.isEmpty())
1265 toolTip += QString(" [") + groupName + QString("]");
1267 item->setToolTip(ENF_VER_NAME_COLUMN,toolTip);
1270 myXCoord->SetValue(x.toDouble());
1271 myYCoord->SetValue(y.toDouble());
1272 myZCoord->SetValue(z.toDouble());
1275 if (!groupName.isEmpty())
1276 myGroupName->setText(groupName);
1280 void BLSURFPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
1281 int nbSelEnfVertex = myEnfVertexWdg->NbObjects();
1282 clearEnforcedVertexWidgets();
1283 if (nbSelEnfVertex == 1)
1285 if ( CORBA::is_nil( getGeomEngine() ) && !GeometryGUI::InitGeomGen() )
1288 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
1289 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
1290 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1291 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
1292 if (CORBA::is_nil(measureOp))
1295 CORBA::Double x,y,z;
1296 measureOp->PointCoordinates (myEnfVertex, x, y, z);
1297 if ( measureOp->IsDone() )
1299 myXCoord->SetValue(x);
1300 myYCoord->SetValue(y);
1301 myZCoord->SetValue(z);
1307 /** BLSURFPluginGUI_HypothesisCreator::synchronizeCoords()
1308 This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
1309 of the enforced vertex clicked in the tree widget.
1311 void BLSURFPluginGUI_HypothesisCreator::synchronizeCoords() {
1312 clearEnforcedVertexWidgets();
1313 QList<QTreeWidgetItem *> items = myEnforcedTreeWidget->selectedItems();
1314 if (! items.isEmpty() && items.size() == 1) {
1315 QTreeWidgetItem *item = items[0];
1316 // for (int i=0 ; i < items.size() ; i++) {
1318 QVariant x = item->data(ENF_VER_X_COLUMN, Qt::EditRole);
1319 QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole);
1320 QVariant z = item->data(ENF_VER_Z_COLUMN, Qt::EditRole);
1321 QVariant entry = item->data(ENF_VER_ENTRY_COLUMN, Qt::EditRole);
1322 QVariant group = item->data(ENF_VER_GROUP_COLUMN, Qt::EditRole);
1323 if (!x.isNull()/* && entry.isNull()*/) {
1324 myXCoord->SetValue(x.toDouble());
1325 myYCoord->SetValue(y.toDouble());
1326 myZCoord->SetValue(z.toDouble());
1329 if (!group.isNull() && (!x.isNull() || !entry.isNull()))
1330 myGroupName->setText(group.toString());
1335 /** BLSURFPluginGUI_HypothesisCreator::addEnforcedFace(entry, shapeName, useInternalVertices)
1336 This method adds a face containing enforced vertices in the tree widget.
1338 QTreeWidgetItem* BLSURFPluginGUI_HypothesisCreator::addEnforcedFace(std::string theFaceEntry, std::string theFaceName) {
1339 // Find theFaceEntry item
1340 QList<QTreeWidgetItem* > theItemList = myEnforcedTreeWidget->findItems(QString(theFaceEntry.c_str()),Qt::MatchExactly,ENF_VER_FACE_ENTRY_COLUMN);
1341 QTreeWidgetItem* theItem;
1342 if (theItemList.empty()) {
1343 theItem = new QTreeWidgetItem();
1344 theItem->setData(ENF_VER_FACE_ENTRY_COLUMN, Qt::EditRole, QVariant(theFaceEntry.c_str()));
1345 theItem->setData(ENF_VER_NAME_COLUMN, Qt::EditRole, QVariant(theFaceName.c_str()));
1346 theItem->setToolTip(ENF_VER_NAME_COLUMN,QString(theFaceEntry.c_str()));
1347 myEnforcedTreeWidget->addTopLevelItem(theItem);
1350 theItem = theItemList[0];
1355 /** BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(entry, shapeName, x, y, z)
1356 This method adds an enforced vertex (x,y,z) to shapeName in the tree widget.
1358 void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z,
1359 std::string vertexName,
1360 std::string geomEntry,
1361 std::string groupName)
1363 bool okToCreate = true;
1365 const int nbVert = myEnforcedTreeWidget->topLevelItemCount();
1366 for (int row = 0; row < nbVert; row++ )
1368 QTreeWidgetItem* child = myEnforcedTreeWidget->topLevelItem( row );
1369 QString childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString();
1370 QString childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString();
1371 double childX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
1372 double childY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
1373 double childZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
1374 if (((childEntry.isEmpty()) && (childX == x) && (childY == y) && (childZ == z)) ||
1375 ( !childEntry.isEmpty() && childEntry == geomEntry.c_str() ))
1377 // update group name
1378 if ( childGroupName != groupName.c_str() ) {
1379 child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
1389 QTreeWidgetItem *vertexItem = new QTreeWidgetItem( myEnforcedTreeWidget );
1390 vertexItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1391 QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
1392 QSize iconSize = iconSelect.size()*0.7;
1394 int vertexIndex=nbVert;
1395 QString myVertexName;
1397 while(indexRef != vertexIndex) {
1398 indexRef = vertexIndex;
1399 if (vertexName.empty())
1400 myVertexName = QString("Vertex #%1").arg(vertexIndex);
1402 myVertexName = QString(vertexName.c_str());
1404 for (int row = 0;row<nbVert;row++) {
1405 QString name = myEnforcedTreeWidget->topLevelItem(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString();
1406 if (myVertexName == name) {
1412 vertexItem->setData( ENF_VER_NAME_COLUMN, Qt::EditRole, myVertexName );
1413 if (geomEntry.empty()) {
1414 vertexItem->setData( ENF_VER_X_COLUMN, Qt::EditRole, QVariant(x) );
1415 vertexItem->setData( ENF_VER_Y_COLUMN, Qt::EditRole, QVariant(y) );
1416 vertexItem->setData( ENF_VER_Z_COLUMN, Qt::EditRole, QVariant(z) );
1419 vertexItem->setIcon(ENF_VER_NAME_COLUMN, QIcon(iconSelect.scaled(iconSize,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1420 vertexItem->setData( ENF_VER_ENTRY_COLUMN, Qt::EditRole, QString(geomEntry.c_str()) );
1422 if (groupName != "")
1423 vertexItem->setData( ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
1425 QString toolTip = myVertexName;
1426 if (geomEntry.empty()) {
1427 toolTip += QString(" (%1, %2, %3").arg(x).arg(y).arg(z);
1429 if (groupName != "")
1430 toolTip += QString(" [%1]").arg(groupName.c_str());
1432 vertexItem->setToolTip(ENF_VER_NAME_COLUMN,toolTip);
1433 myEnforcedTreeWidget->setCurrentItem(vertexItem,ENF_VER_NAME_COLUMN);
1436 /** BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
1437 This method is called when a item is added into the enforced vertices tree widget
1439 void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
1441 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1443 getGeomSelectionTool()->selectionMgr()->clearFilters();
1444 myEnfVertexWdg->deactivateSelection();
1446 for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
1447 myEnforcedTreeWidget->resizeColumnToContents(column);
1450 int selEnfVertex = myEnfVertexWdg->NbObjects();
1451 bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
1453 if ((selEnfVertex == 0) && coordsEmpty)
1456 string entry, shapeName;
1458 std::string groupName = myGroupName->text().simplified().toStdString();
1460 if (selEnfVertex <= 1)
1463 x = myXCoord->GetValue();
1464 y = myYCoord->GetValue();
1465 z = myZCoord->GetValue();
1466 if (selEnfVertex == 1) {
1467 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
1468 addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
1471 addEnforcedVertex(x, y, z, "", "", groupName);
1475 if ( CORBA::is_nil(getGeomEngine()))
1478 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
1479 if (CORBA::is_nil(measureOp))
1482 CORBA::Double x,y,z;
1484 for (int j = 0 ; j < selEnfVertex ; j++)
1486 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(j);
1487 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
1488 measureOp->PointCoordinates (myEnfVertex, x, y, z);
1489 if ( measureOp->IsDone() )
1490 addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
1491 } else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
1492 addEnforcedVertex(0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
1498 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
1500 for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
1501 myEnforcedTreeWidget->resizeColumnToContents(column);
1503 if ( myStdWidget->myPhysicalMesh->currentIndex() != PhysicalLocalSize ) {
1504 myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize );
1505 myStdWidget->onPhysicalMeshChanged();
1509 /** BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
1510 This method is called when a item is removed from the enforced vertices tree widget
1512 void BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() {
1513 QList<QTreeWidgetItem *> selectedItems = myEnforcedTreeWidget->selectedItems();
1514 QList<QTreeWidgetItem *> selectedVertices;
1515 QSet<QTreeWidgetItem *> selectedEntries;
1516 QTreeWidgetItem* item;
1518 foreach( item, selectedItems ) {
1519 QVariant value = item->data(ENF_VER_X_COLUMN, Qt::EditRole);
1520 if (! value.isNull())
1521 selectedVertices.append(item);
1523 value = item->data(ENF_VER_ENTRY_COLUMN, Qt::EditRole);
1524 if (! value.isNull())
1525 selectedVertices.append(item);
1527 selectedEntries.insert(item);
1531 foreach(item,selectedVertices) {
1532 QTreeWidgetItem* parent = item->parent();
1534 parent->removeChild(item);
1536 if ( parent && parent->childCount() == 0) {
1537 if (selectedEntries.contains(parent))
1538 selectedEntries.remove(parent);
1543 foreach(item,selectedEntries) {
1547 myEnforcedTreeWidget->selectionModel()->clearSelection();
1551 void BLSURFPluginGUI_HypothesisCreator::onInternalVerticesClicked(int state)
1553 myInternalEnforcedVerticesAllFacesGroup->setEnabled(state == Qt::Checked);
1556 /** BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity()
1557 This method is called when a item is added into the periodicity table widget
1559 void BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity() {
1561 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1563 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1564 ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
1565 for ( ; anIt != myPeriodicitySelectionWidgets.end(); anIt++)
1567 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1568 w1->deactivateSelection();
1572 // Source-Target selection
1573 int selSource = myPeriodicitySourceFaceWdg->NbObjects();
1574 int selTarget = myPeriodicityTargetFaceWdg->NbObjects();
1576 if (selSource == 0 || selTarget == 0)
1579 // Vertices selection
1580 if (myPeriodicityGroupBox2->isChecked())
1582 int P1Ssel = myPeriodicityP1SourceWdg->NbObjects();
1583 int P2Ssel = myPeriodicityP2SourceWdg->NbObjects();
1584 int P3Ssel = myPeriodicityP3SourceWdg->NbObjects();
1585 int P1Tsel = myPeriodicityP1TargetWdg->NbObjects();
1586 //int P2Tsel = myPeriodicityP2TargetWdg->NbObjects();
1587 int P3Tsel = myPeriodicityP3TargetWdg->NbObjects();
1589 if (P1Ssel!=1 || P2Ssel!=1 || P3Ssel!=1 || P1Tsel!=1 || P3Tsel!=1 || P3Tsel!=1)
1591 QString msg = tr("BLSURF_PERIODICITY_WRONG_NUMBER_OF_VERTICES");
1592 SUIT_MessageBox::critical( dlg(),"Error" , msg );
1597 // Add Source-Target in table
1598 string shapeEntry, sourceEntry, targetEntry;
1599 string shapeName, sourceName, targetName;
1600 GEOM::GEOM_Object_var shape;
1602 QTreeWidgetItem* item = new QTreeWidgetItem();
1603 myPeriodicityTreeWidget->addTopLevelItem(item);
1605 item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
1609 for (anIt = myPeriodicitySelectionWidgets.begin(); anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
1611 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1612 shape = w1->GetObject< GEOM::GEOM_Object >(0);
1613 shapeName = shape->GetName();
1614 shapeEntry = shape->GetStudyEntry();
1615 item->setData(k, Qt::EditRole, shapeName.c_str() );
1616 item->setData(k, Qt::UserRole, shapeEntry.c_str() );
1617 if (! myPeriodicityGroupBox2->isChecked() && k==1)
1621 // Add shape type in tree
1622 string onFace = (myPeriodicityOnFaceRadioButton->isChecked()) ? "1" : "0";
1623 item->setData(PERIODICITY_SHAPE_TYPE, Qt::UserRole, onFace.c_str());
1625 // Blank input fields
1626 for (anIt = myPeriodicitySelectionWidgets.begin(); anIt != myPeriodicitySelectionWidgets.end(); anIt++)
1628 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1629 w1->SetObject(GEOM::GEOM_Object::_nil());
1632 // for (int column = 0; column < myPeriodicityTreeWidget->columnCount(); ++column)
1633 // myPeriodicityTreeWidget->resizeColumnToContents(column);
1637 /** BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity()
1638 This method is called when a item is removed from the periodicity tree widget
1640 void BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity() {
1641 QList<QTreeWidgetItem *> selectedItems = myPeriodicityTreeWidget->selectedItems();
1642 QTreeWidgetItem* item;
1644 foreach(item,selectedItems) {
1648 myEnforcedTreeWidget->selectionModel()->clearSelection();
1651 /** BLSURFPluginGUI_HypothesisCreator::onPeriodicityByVerticesChecked()
1652 This method enable clears the field for periodicity by vertices
1654 void BLSURFPluginGUI_HypothesisCreator::onPeriodicityByVerticesChecked(bool checked)
1658 for (int k=2; k<myPeriodicitySelectionWidgets.size(); k++)
1660 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( myPeriodicitySelectionWidgets[k] );
1661 w1->deactivateSelection();
1662 w1->SetObject(CORBA::Object::_nil());
1667 /** BLSURFPluginGUI_HypothesisCreator::onPeriodicityRadioButtonChanged()
1668 This method enable the proper shape selection widget to Face or Edge shapes
1670 //void BLSURFPluginGUI_HypothesisCreator::onPeriodicityRadioButtonChanged()
1672 // if (myPeriodicityOnFaceRadioButton->isChecked())
1674 // myPeriodicitySourceEdgeWdg->hide();
1675 // myPeriodicityTargetEdgeWdg->hide();
1676 // myPeriodicitySourceFaceWdg->show();
1677 // myPeriodicityTargetFaceWdg->show();
1681 // myPeriodicitySourceFaceWdg->hide();
1682 // myPeriodicityTargetFaceWdg->hide();
1683 // myPeriodicitySourceEdgeWdg->show();
1684 // myPeriodicityTargetEdgeWdg->show();
1688 void BLSURFPluginGUI_HypothesisCreator::onPeriodicityTreeClicked(QTreeWidgetItem* item, int row)
1690 QString shapeName, shapeEntry;
1691 CORBA::Object_var shape;
1693 ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
1694 for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
1696 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1698 shapeName = item->data(k, Qt::EditRole).toString();
1699 shapeEntry = item->data(k, Qt::UserRole).toString();
1700 if (! shapeEntry.isEmpty())
1702 shape = entryToObject(shapeEntry);
1703 w1->SetObject(shape);
1704 w1->deactivateSelection();
1706 myPeriodicityGroupBox2->setChecked(1);
1709 myPeriodicityGroupBox2->setChecked(0);
1712 if (item->data(PERIODICITY_SHAPE_TYPE, Qt::UserRole) == "1")
1713 myPeriodicityOnFaceRadioButton->setChecked(true);
1715 myPeriodicityOnEdgeRadioButton->setChecked(true);
1720 /** BLSURFPluginGUI_HypothesisCreator::onPeriodicityContentModified()
1721 This method gives the focus to the next selection widget when a content is modified in a selection widget.
1723 void BLSURFPluginGUI_HypothesisCreator::onPeriodicityContentModified()
1725 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1727 ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
1729 // find wich selection widget is activated
1730 for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
1732 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1733 if (w1->IsSelectionActivated() && k<(myPeriodicitySelectionWidgets.size()-1))
1735 // don't activate vertex selection if the group box is not checked
1736 if (k==1 && !myPeriodicityGroupBox2->isChecked())
1738 // clear the selection, to avoid to put the same object in the other widget
1739 that->getGeomSelectionTool()->selectionMgr()->clearSelected();
1740 // activate the next widget
1741 StdMeshersGUI_ObjectReferenceParamWdg * w2 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( myPeriodicitySelectionWidgets[k+1] );
1742 w2->activateSelection();
1749 /** BLSURFPluginGUI_HypothesisCreator::retrieveParams()
1750 This method updates the GUI widgets with the hypothesis data
1752 void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
1754 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1756 BlsurfHypothesisData data;
1757 that->readParamsFromHypo( data );
1760 myName->setText( data.myName );
1761 QFontMetrics metrics( myName->font() );
1762 myName->setMinimumWidth( metrics.width( data.myName )+5 );
1764 myStdWidget->myPhysicalMesh->setCurrentIndex( data.myPhysicalMesh );
1765 myStdWidget->myGeometricMesh->setCurrentIndex( data.myGeometricMesh );
1766 if (data.myPhySize <= 0)
1767 myStdWidget->myPhySize->setText("");
1769 myStdWidget->myPhySize->SetValue( data.myPhySize );
1770 myStdWidget->myPhySizeRel->setChecked( data.myPhySizeRel );
1771 if (data.myMinSize < 0)
1772 myStdWidget->myMinSize->setText("");
1774 myStdWidget->myMinSize->SetValue( data.myMinSize );
1775 myStdWidget->myMinSizeRel->setChecked( data.myMinSizeRel );
1776 if (data.myMaxSize < 0)
1777 myStdWidget->myMaxSize->setText("");
1779 myStdWidget->myMaxSize->SetValue( data.myMaxSize );
1780 myStdWidget->myMaxSizeRel->setChecked( data.myMaxSizeRel );
1781 myStdWidget->myUseGradation->setChecked( data.myUseGradation );
1782 if (data.myGradation <= 0 || !data.myUseGradation )
1783 myStdWidget->myGradation->setText("");
1785 myStdWidget->myGradation->SetValue( data.myGradation );
1786 myStdWidget->myUseVolumeGradation->setChecked( data.myUseVolumeGradation );
1787 if (data.myVolumeGradation <= 0 || !data.myUseVolumeGradation )
1788 myStdWidget->myVolumeGradation->setText("");
1790 myStdWidget->myVolumeGradation->SetValue( data.myVolumeGradation );
1791 myStdWidget->myAllowQuadrangles->setChecked( data.myAllowQuadrangles );
1793 if (data.myAngleMesh < 0)
1794 myStdWidget->myAngleMesh->setText("");
1796 myStdWidget->myAngleMesh->SetValue( data.myAngleMesh );
1797 if (data.myChordalError <= 0)
1798 myStdWidget->myChordalError->setText("");
1800 myStdWidget->myChordalError->SetValue( data.myChordalError );
1801 myStdWidget->myAnisotropic->setChecked( data.myAnisotropic );
1802 if (data.myAnisotropicRatio <= 0)
1803 myStdWidget->myAnisotropicRatio->setText("");
1805 myStdWidget->myAnisotropicRatio->SetValue( data.myAnisotropicRatio );
1806 myStdWidget->myRemoveTinyEdges->setChecked( data.myRemoveTinyEdges );
1807 if (data.myTinyEdgeLength <= 0)
1808 myStdWidget->myTinyEdgeLength->setText("");
1810 myStdWidget->myTinyEdgeLength->SetValue( data.myTinyEdgeLength );
1811 myStdWidget->myOptimiseTinyEdges->setChecked( data.myOptimiseTinyEdges );
1812 if (data.myTinyEdgeOptimisLength <= 0)
1813 myStdWidget->myTinyEdgeOptimisLength->setText("");
1815 myStdWidget->myTinyEdgeOptimisLength->SetValue( data.myTinyEdgeOptimisLength );
1816 myStdWidget->myCorrectSurfaceIntersection->setChecked( data.myCorrectSurfaceIntersection );
1817 if (data.myCorrectSurfaceIntersectionMaxCost <= 0)
1818 myStdWidget->myCorrectSurfaceIntersectionMaxCost->setText("");
1820 myStdWidget->myCorrectSurfaceIntersectionMaxCost->SetValue( data.myCorrectSurfaceIntersectionMaxCost );
1821 myStdWidget->myForceBadElementRemoval->setChecked( data.myForceBadElementRemoval );
1822 if (data.myBadElementAspectRatio <= 0)
1823 myStdWidget->myBadElementAspectRatio->setText("");
1825 myStdWidget->myBadElementAspectRatio->SetValue( data.myBadElementAspectRatio );
1826 myStdWidget->myOptimizeMesh->setChecked( data.myOptimizeMesh );
1827 myStdWidget->myQuadraticMesh->setChecked( data.myQuadraticMesh );
1829 myStdWidget->resizeWidgets();
1831 myAdvWidget->myVerbosity->setValue( data.myVerbosity );
1833 if ( myOptions.operator->() ) {
1834 for ( int i = 0, nb = myOptions->length(); i < nb; ++i )
1835 myAdvWidget->AddOption( TBL_MESHING, that->myOptions[i].in() );
1837 if ( myPreCADOptions.operator->() ) {
1838 for ( int i = 0, nb = myPreCADOptions->length(); i < nb; ++i )
1839 myAdvWidget->AddOption( TBL_PRECAD, that->myPreCADOptions[i].in() );
1841 if ( myCustomOptions.operator->() ) {
1842 for ( int i = 0, nb = myCustomOptions->length(); i < nb; ++i )
1843 myAdvWidget->AddOption( TBL_CUSTOM, that->myCustomOptions[i].in() );
1845 myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
1846 myAdvWidget->myGMFFileName->setText(QString(data.myGMFFileName.c_str()));
1847 // myGMFFileMode->setChecked(data.myGMFFileMode);
1850 QMapIterator<QString, QString> i(that->mySMPMap);
1851 GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
1852 while (i.hasNext()) {
1854 const QString entry = i.key();
1855 const QString sizeMap = i.value();
1856 string shapeName = myGeomToolSelected->getNameFromEntry(entry.toStdString());
1857 //int row = mySizeMapTable->topLevelItemCount();
1858 QTreeWidgetItem* item = new QTreeWidgetItem();
1859 mySizeMapTable->addTopLevelItem( item );
1860 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled );
1861 item->setData(SMP_ENTRY_COLUMN,Qt::DisplayRole, QVariant(entry) );
1862 item->setData(SMP_NAME_COLUMN, Qt::DisplayRole, QVariant( QString::fromStdString(shapeName) ) );
1863 if (that->myATTMap.contains(entry)) {
1864 TAttractorVec & attVec = that->myATTMap[entry];
1865 for ( size_t i = 0; i < attVec.size(); ++i )
1867 std::string attName = myGeomToolSelected->getNameFromEntry( attVec[i].attEntry );
1868 QTreeWidgetItem* child = new QTreeWidgetItem();
1869 item->addChild( child );
1870 item->setExpanded(true);
1871 child->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( attVec[i].startSize ));
1872 child->setData(SMP_ENTRY_COLUMN, Qt::DisplayRole, QVariant( attVec[i].attEntry.c_str() ));
1873 child->setData(SMP_NAME_COLUMN, Qt::DisplayRole, QVariant( attName.c_str() ));
1875 if ( attVec[i].infDist > std::numeric_limits<double>::epsilon()){
1876 item->setData(SMP_SIZEMAP_COLUMN, Qt::DisplayRole, QVariant( "Attractor" ));
1879 item->setData(SMP_SIZEMAP_COLUMN, Qt::DisplayRole, QVariant( "Constant Size" ));
1885 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( sizeMap ) );
1888 mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
1889 mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
1890 mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
1892 // Enforced vertices
1893 TFaceEntryEnfVertexListMap::const_iterator evmIt = data.faceEntryEnfVertexListMap.begin();
1895 for ( ; evmIt != data.faceEntryEnfVertexListMap.end() ; ++evmIt) {
1896 TEntry entry = (*evmIt).first;
1897 std::string shapeName = myGeomToolSelected->getNameFromEntry(entry);
1899 //QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
1901 TEnfVertexList evs = (*evmIt).second;
1903 TEnfVertexList::const_iterator evsIt = evs.begin();
1904 TEnfVertex *enfVertex;
1905 for ( ; evsIt != evs.end() ; ++evsIt) {
1906 enfVertex = (*evsIt);
1907 double x = 0, y = 0, z = 0;
1908 if (enfVertex->coords.size()) {
1909 x = enfVertex->coords[0];
1910 y = enfVertex->coords[1];
1911 z = enfVertex->coords[2];
1913 that->addEnforcedVertex(x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
1917 for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
1918 myEnforcedTreeWidget->resizeColumnToContents(column);
1920 myInternalEnforcedVerticesAllFaces->setChecked(data.myInternalEnforcedVerticesAllFaces);
1921 myInternalEnforcedVerticesAllFacesGroup->setText(QString(data.myInternalEnforcedVerticesAllFacesGroup.c_str()));
1922 myInternalEnforcedVerticesAllFacesGroup->setEnabled(data.myInternalEnforcedVerticesAllFaces);
1926 // Add an item in the tree widget for each association
1927 for (size_t i=0 ; i<data.preCadPeriodicityVector.size() ; i++)
1929 QTreeWidgetItem* item = new QTreeWidgetItem();
1930 myPeriodicityTreeWidget->addTopLevelItem(item);
1931 item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
1932 TPreCadPeriodicity periodicity_i = data.preCadPeriodicityVector[i];
1933 for (size_t k=0; k<periodicity_i.size(); k++)
1935 string shapeEntry = periodicity_i[k];
1936 string shapeName = myGeomToolSelected->getNameFromEntry(shapeEntry);
1937 item->setData(k, Qt::EditRole, shapeName.c_str() );
1938 item->setData(k, Qt::UserRole, shapeEntry.c_str() );
1943 for ( int i = 0; i < data.hyperpatches.size(); ++i )
1944 that->addHyPatchToTable( data.hyperpatches[i] );
1947 that->myStdWidget->onPhysicalMeshChanged();
1948 that->myStdWidget->onGeometricMeshChanged();
1949 that->onStateChange();
1952 /** BLSURFPluginGUI_HypothesisCreator::storeParams()
1953 This method updates the hypothesis data with the GUI widgets content.
1955 QString BLSURFPluginGUI_HypothesisCreator::storeParams() const
1957 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1959 BlsurfHypothesisData data;
1960 QString guiHyp = that->readParamsFromWidgets( data );
1961 that->storeParamsToHypo( data );
1966 /** BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo(h_data)
1967 Updates the hypothesis data from hypothesis values.
1969 bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData& h_data ) const
1971 BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
1972 BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() );
1974 HypothesisData* data = SMESH::GetHypothesisData( hypType() );
1975 h_data.myName = isCreation() && data ? hypName() : "";
1977 h_data.myPhysicalMesh = (int) h->GetPhysicalMesh();
1978 h_data.myGeometricMesh = (int) h->GetGeometricMesh();
1979 h_data.myPhySize = h->GetPhySize();
1980 h_data.myPhySizeRel = h->IsPhySizeRel();
1981 double minSize = h->GetMinSize();
1982 double maxSize = h->GetMaxSize();
1983 h_data.myMinSize = minSize > 0 ? minSize : -1.0;
1984 h_data.myMinSizeRel = h->IsMinSizeRel();
1985 h_data.myMaxSize = maxSize > 0 ? maxSize : -1.0;
1986 h_data.myMaxSizeRel = h->IsMaxSizeRel();
1987 h_data.myUseGradation = h->GetUseGradation();
1988 h_data.myGradation = h->GetGradation();
1989 h_data.myUseVolumeGradation = h->GetUseVolumeGradation();
1990 h_data.myVolumeGradation = h->GetVolumeGradation();
1991 h_data.myAllowQuadrangles = h->GetQuadAllowed();
1992 double angle = h->GetAngleMesh();
1993 h_data.myAngleMesh = angle > 0 ? angle : -1.0;
1994 double chordalError = h->GetChordalError();
1995 h_data.myChordalError = chordalError > 0 ? chordalError : -1.0;
1996 h_data.myAnisotropic = h->GetAnisotropic();
1997 double myAnisotropicRatio = h->GetAnisotropicRatio();
1998 h_data.myAnisotropicRatio = myAnisotropicRatio > 0 ? myAnisotropicRatio : -1.0;
1999 h_data.myRemoveTinyEdges = h->GetRemoveTinyEdges();
2000 double myTinyEdgeLength = h->GetTinyEdgeLength();
2001 h_data.myTinyEdgeLength = myTinyEdgeLength > 0 ? myTinyEdgeLength : -1.0;
2002 h_data.myOptimiseTinyEdges = h->GetOptimiseTinyEdges();
2003 double myTinyEdgeOptimisLength = h->GetTinyEdgeOptimisationLength();
2004 h_data.myTinyEdgeOptimisLength = myTinyEdgeOptimisLength > 0 ? myTinyEdgeOptimisLength : -1.0;
2005 h_data.myCorrectSurfaceIntersection = h->GetCorrectSurfaceIntersection();
2006 double corrSurfaceIntersMaxCost = h->GetCorrectSurfaceIntersectionMaxCost();
2007 h_data.myCorrectSurfaceIntersectionMaxCost = corrSurfaceIntersMaxCost > 0 ? corrSurfaceIntersMaxCost : -1.0;
2008 h_data.myForceBadElementRemoval = h->GetBadElementRemoval();
2009 double myBadElementAspectRatio = h->GetBadElementAspectRatio();
2010 h_data.myBadElementAspectRatio = myBadElementAspectRatio > 0 ? myBadElementAspectRatio : -1.0;
2011 h_data.myOptimizeMesh = h->GetOptimizeMesh();
2012 h_data.myQuadraticMesh = h->GetQuadraticMesh();
2013 h_data.myVerbosity = h->GetVerbosity();
2014 //h_data.myTopology = (int) h->GetTopology();
2015 //h_data.myPreCADMergeEdges = h->GetPreCADMergeEdges();
2016 // h_data.myPreCADProcess3DTopology = h->GetPreCADProcess3DTopology();
2017 // h_data.myPreCADDiscardInput = h->GetPreCADDiscardInput();
2020 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2021 that->myOptions = h->GetOptionValues();
2022 that->myPreCADOptions = h->GetPreCADOptionValues();
2023 that->myCustomOptions = h->GetAdvancedOptionValues();
2025 h_data.myGMFFileName = h->GetGMFFile();
2026 // h_data.myGMFFileMode = h->GetGMFFileMode();
2028 that->mySMPMap.clear();
2029 that->myATTMap.clear();
2030 // that->myAttDistMap.clear();
2031 // that->myDistMap.clear();
2033 // classic size maps
2034 BLSURFPlugin::string_array_var mySizeMaps = h->GetSizeMapEntries();
2035 QString fullSizeMaps;
2036 QStringList fullSizeMapList;
2037 GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
2038 for ( CORBA::ULong i = 0;i<mySizeMaps->length(); ++i ) {
2039 fullSizeMaps = mySizeMaps[i].in();
2040 fullSizeMapList = fullSizeMaps.split( "|", QString::KeepEmptyParts );
2041 if ( fullSizeMapList.count() > 1 ) {
2042 string fullSizeMap = fullSizeMapList[1].toStdString();
2043 int pos = fullSizeMap.find("return")+7;
2046 sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos));
2051 that->mySMPMap[fullSizeMapList[0]] = sizeMap;
2052 that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShapeType(fullSizeMapList[0].toStdString());
2058 BLSURFPlugin::string_array_var myCustomSizeMaps = h->GetCustomSizeMapEntries();
2060 for ( int i = 0;i<myCustomSizeMaps->length(); ++i ) {
2061 QString fullCustomSizeMaps = myCustomSizeMaps[i].in();
2062 QStringList fullCustomSizeMapList = fullCustomSizeMaps.split( "|", QString::KeepEmptyParts );
2063 if ( fullCustomSizeMapList.count() > 1 ) {
2064 that->mySMPMap[fullCustomSizeMapList[0]] = fullCustomSizeMapList[1];
2065 that->mySMPShapeTypeMap[fullCustomSizeMapList[0]] = GeomToolSelected->entryToShapeType(fullCustomSizeMapList[0].toStdString());
2070 BLSURFPlugin::string_array_var allMyAttractors = h->GetAttractorEntries();
2072 for ( CORBA::ULong i = 0;i<allMyAttractors->length(); ++i ) {
2073 QString myAttractors = allMyAttractors[i].in();
2074 QStringList myAttractorList = myAttractors.split( "|", QString::KeepEmptyParts );
2075 if ( myAttractorList.count() > 1 ) {
2076 that->mySMPMap[myAttractorList[0]] = myAttractorList[1];
2077 that->mySMPShapeTypeMap[myAttractorList[0]] = myGeomToolSelected->entryToShapeType(myAttractorList[0].toStdString());
2081 // attractor new version
2082 BLSURFPlugin::TAttParamsMap_var allMyAttractorParams = h->GetAttractorParams();
2083 for ( CORBA::ULong i = 0;i<allMyAttractorParams->length(); ++i ) {
2084 BLSURFPlugin::TAttractorParams myAttractorParams = allMyAttractorParams[i];
2085 QString faceEntry = myAttractorParams.faceEntry.in();
2086 QString attEntry = myAttractorParams.attEntry.in();
2087 that->mySMPMap[faceEntry] = QString::number( myAttractorParams.startSize, 'g', 6 ); // TODO utiliser les préférences ici (cf. sketcher)
2088 that->mySMPShapeTypeMap[faceEntry] = myGeomToolSelected->entryToShapeType(faceEntry.toStdString());
2089 that->myATTMap[faceEntry].push_back( TAttractor( myAttractorParams.attEntry.in(),
2090 myAttractorParams.startSize,
2091 myAttractorParams.infDist,
2092 myAttractorParams.constDist ));
2095 // Enforced vertices
2096 h_data.enfVertexList.clear();
2097 h_data.faceEntryEnfVertexListMap.clear();
2099 h_data.groupNameEnfVertexListMap.clear();
2102 BLSURFPlugin::TFaceEntryEnfVertexListMap_var faceEntryEnfVertexListMap = h->GetAllEnforcedVerticesByFace();
2104 for ( CORBA::ULong i = 0;i<faceEntryEnfVertexListMap->length(); ++i )
2106 std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in();
2107 BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList;
2109 for (CORBA::ULong j=0 ; j<vertexList.length(); ++j)
2111 TEnfVertex *enfVertex = new TEnfVertex();
2112 enfVertex->name = vertexList[j].name.in();
2113 enfVertex->geomEntry = vertexList[j].geomEntry.in();
2114 enfVertex->grpName = vertexList[j].grpName.in();
2115 for (CORBA::ULong k=0 ; k< vertexList[j].coords.length();k++)
2116 enfVertex->coords.push_back(vertexList[j].coords[k]);
2118 h_data.faceEntryEnfVertexListMap[entry].insert(enfVertex);
2121 if (groupName != "") {
2122 h_data.groupNameEnfVertexListMap[groupName].insert(ev);
2126 // h_data.enfVertMap[entry] = evs;
2127 // h_data.entryCoordsListMap[entry] = coordsList;
2129 if (h_data.faceEntryEnfVertexListMap[entry].size() == 0) {
2130 h_data.faceEntryEnfVertexListMap.erase(entry);
2133 h_data.myInternalEnforcedVerticesAllFaces = h->GetInternalEnforcedVertexAllFaces();
2134 h_data.myInternalEnforcedVerticesAllFacesGroup = h->GetInternalEnforcedVertexAllFacesGroup();
2138 h_data.preCadPeriodicityVector.clear();
2140 BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector = h->GetPreCadFacesPeriodicityVector();
2141 AddPreCadSequenceToVector(h_data, preCadFacePeriodicityVector, true);
2143 BLSURFPlugin::TPeriodicityList_var preCadEdgePeriodicityVector = h->GetPreCadEdgesPeriodicityVector();
2144 AddPreCadSequenceToVector(h_data, preCadEdgePeriodicityVector, false);
2148 h_data.hyperpatches.clear();
2149 BLSURFPlugin::THyperPatchList_var patchList = h->GetHyperPatches();
2150 for ( CORBA::ULong i = 0; i < patchList->length(); ++i )
2153 BLSURFPlugin::THyperPatch& patch = patchList[i];
2154 for ( CORBA::ULong j = 0; j < patch.length(); ++j )
2155 tags += QString::number( patch[j] ) + " ";
2156 if ( !tags.isEmpty() )
2157 h_data.hyperpatches.append( tags );
2163 void BLSURFPluginGUI_HypothesisCreator::AddPreCadSequenceToVector(BlsurfHypothesisData& h_data,
2164 BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector, bool onFace) const
2167 for (size_t i=0; i<preCadFacePeriodicityVector->length(); i++ )
2169 TPreCadPeriodicity periodicity_i(PERIODICITY_NB_COLUMN);
2170 periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN] = preCadFacePeriodicityVector[i].shape1Entry.in();
2171 periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN] = preCadFacePeriodicityVector[i].shape2Entry.in();
2173 BLSURFPlugin::TEntryList sourceVertices = preCadFacePeriodicityVector[i].theSourceVerticesEntries;
2174 BLSURFPlugin::TEntryList targetVertices = preCadFacePeriodicityVector[i].theTargetVerticesEntries;
2176 if (sourceVertices.length()!=0)
2178 periodicity_i[PERIODICITY_P1_SOURCE_COLUMN] = sourceVertices[0].in();
2179 periodicity_i[PERIODICITY_P2_SOURCE_COLUMN] = sourceVertices[1].in();
2180 periodicity_i[PERIODICITY_P3_SOURCE_COLUMN] = sourceVertices[2].in();
2183 if (targetVertices.length()!=0)
2185 periodicity_i[PERIODICITY_P1_TARGET_COLUMN] = targetVertices[0].in();
2186 periodicity_i[PERIODICITY_P2_TARGET_COLUMN] = targetVertices[1].in();
2187 periodicity_i[PERIODICITY_P3_TARGET_COLUMN] = targetVertices[2].in();
2191 periodicity_i[PERIODICITY_SHAPE_TYPE] = "1";
2193 periodicity_i[PERIODICITY_SHAPE_TYPE] = "0";
2195 h_data.preCadPeriodicityVector.push_back(periodicity_i);
2199 /** BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo(h_data)
2200 Saves the hypothesis data to hypothesis values.
2202 bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesisData& h_data ) const
2204 BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
2205 BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
2211 SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
2213 if ( h->GetPhysicalMesh() != h_data.myPhysicalMesh ) // avoid duplication of DumpPython commands
2214 h->SetPhysicalMesh( (int) h_data.myPhysicalMesh );
2215 if ( h->GetGeometricMesh() != (int) h_data.myGeometricMesh )
2216 h->SetGeometricMesh( (int) h_data.myGeometricMesh );
2218 if ( ((int) h_data.myPhysicalMesh == PhysicalGlobalSize)||((int) h_data.myPhysicalMesh == PhysicalLocalSize) ) {
2219 if ( h->GetPhySize() != h_data.myPhySize ||
2220 h->IsPhySizeRel() != h_data.myPhySizeRel ) {
2221 if ( h_data.myPhySizeRel )
2222 h->SetPhySizeRel( h_data.myPhySize );
2224 h->SetPhySize( h_data.myPhySize );
2227 if (h->GetMinSize() != h_data.myMinSize ||
2228 h->IsMinSizeRel() != h_data.myMinSizeRel ) {
2229 if ( h_data.myMinSizeRel )
2230 h->SetMinSizeRel( h_data.myMinSize <= 0 ? -1 : h_data.myMinSize );
2232 h->SetMinSize( h_data.myMinSize <= 0 ? -1 : h_data.myMinSize );
2234 if (h->GetMaxSize() != h_data.myMaxSize ||
2235 h->IsMaxSizeRel() != h_data.myMaxSizeRel ) {
2236 if ( h_data.myMaxSizeRel )
2237 h->SetMaxSizeRel( h_data.myMaxSize <= 0 ? -1 : h_data.myMaxSize );
2239 h->SetMaxSize( h_data.myMaxSize <= 0 ? -1 : h_data.myMaxSize );
2241 if ( h->GetUseGradation() != h_data.myUseGradation )
2242 h->SetUseGradation( h_data.myUseGradation );
2243 if ( h->GetGradation() != h_data.myGradation )
2244 h->SetGradation( h_data.myGradation <= 0 ? -1 : h_data.myGradation );
2245 if ( h->GetUseVolumeGradation() != h_data.myUseVolumeGradation )
2246 h->SetUseVolumeGradation( h_data.myUseVolumeGradation );
2247 if ( h->GetVolumeGradation() != h_data.myVolumeGradation )
2248 h->SetVolumeGradation( h_data.myVolumeGradation <= 0 ? -1 : h_data.myVolumeGradation );
2250 if ( h->GetQuadAllowed() != h_data.myAllowQuadrangles )
2251 h->SetQuadAllowed( h_data.myAllowQuadrangles );
2253 if ( (int) h_data.myGeometricMesh != DefaultGeom ) {
2254 if ( h->GetAngleMesh() != h_data.myAngleMesh )
2255 h->SetAngleMesh( h_data.myAngleMesh <= 0 ? -1 :h_data.myAngleMesh );
2256 if ( h->GetChordalError() != h_data.myChordalError )
2257 h->SetChordalError( h_data.myChordalError <= 0 ? -1 :h_data.myChordalError );
2260 if ( h->GetAnisotropic() != h_data.myAnisotropic )
2261 h->SetAnisotropic( h_data.myAnisotropic );
2262 if ( h_data.myAnisotropic && ( h->GetAnisotropicRatio() != h_data.myAnisotropicRatio ) )
2263 h->SetAnisotropicRatio( h_data.myAnisotropicRatio <= 0 ? -1 :h_data.myAnisotropicRatio );
2265 if ( h->GetRemoveTinyEdges() != h_data.myRemoveTinyEdges )
2266 h->SetRemoveTinyEdges( h_data.myRemoveTinyEdges );
2267 if ( h_data.myRemoveTinyEdges && ( h->GetTinyEdgeLength() != h_data.myTinyEdgeLength ) )
2268 h->SetTinyEdgeLength( h_data.myTinyEdgeLength <= 0 ? -1 :h_data.myTinyEdgeLength );
2270 if ( h->GetOptimiseTinyEdges() != h_data.myOptimiseTinyEdges )
2271 h->SetOptimiseTinyEdges( h_data.myOptimiseTinyEdges );
2272 if ( h_data.myOptimiseTinyEdges && ( h->GetTinyEdgeOptimisationLength() != h_data.myTinyEdgeOptimisLength ) )
2273 h->SetTinyEdgeOptimisationLength( h_data.myTinyEdgeOptimisLength <= 0 ? -1 :h_data.myTinyEdgeOptimisLength );
2274 if ( h->GetCorrectSurfaceIntersection() != h_data.myCorrectSurfaceIntersection )
2275 h->SetCorrectSurfaceIntersection( h_data.myCorrectSurfaceIntersection );
2276 if ( h_data.myCorrectSurfaceIntersection && ( h->GetCorrectSurfaceIntersectionMaxCost() != h_data.myCorrectSurfaceIntersectionMaxCost ) )
2277 h->SetCorrectSurfaceIntersectionMaxCost( h_data.myCorrectSurfaceIntersectionMaxCost <= 0 ? -1 :h_data.myCorrectSurfaceIntersectionMaxCost );
2279 if ( h->GetBadElementRemoval() != h_data.myForceBadElementRemoval )
2280 h->SetBadElementRemoval( h_data.myForceBadElementRemoval );
2281 if ( h_data.myForceBadElementRemoval && ( h->GetBadElementAspectRatio() != h_data.myBadElementAspectRatio ) )
2282 h->SetBadElementAspectRatio( h_data.myBadElementAspectRatio <= 0 ? -1 :h_data.myBadElementAspectRatio );
2284 if ( h->GetOptimizeMesh() != h_data.myOptimizeMesh )
2285 h->SetOptimizeMesh( h_data.myOptimizeMesh );
2287 if ( h->GetQuadraticMesh() != h_data.myQuadraticMesh )
2288 h->SetQuadraticMesh( h_data.myQuadraticMesh );
2290 if ( h->GetVerbosity() != h_data.myVerbosity )
2291 h->SetVerbosity( h_data.myVerbosity );
2292 // if ( h->GetTopology() != h_data.myTopology )
2293 // h->SetTopology( (int) h_data.myTopology );
2294 // if ( h->GetPreCADMergeEdges() != h_data.myPreCADMergeEdges )
2295 // h->SetPreCADMergeEdges( h_data.myPreCADMergeEdges );
2296 // if ( h->GetPreCADProcess3DTopology() != h_data.myPreCADProcess3DTopology )
2297 // h->SetPreCADProcess3DTopology( h_data.myPreCADProcess3DTopology );
2298 // if ( h->GetPreCADDiscardInput() != h_data.myPreCADDiscardInput )
2299 // h->SetPreCADDiscardInput( h_data.myPreCADDiscardInput );
2301 // options are set in checkParams()
2302 //h->SetOptionValues( myOptions ); // is set in readParamsFromWidgets()
2303 //h->SetPreCADOptionValues( myPreCADOptions ); // is set in readParamsFromWidgets()
2305 if ( h->GetGMFFile() != h_data.myGMFFileName )
2306 // || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
2307 // h->SetGMFFile( h_data.myGMFFileName.c_str(), h_data.myGMFFileMode );
2308 h->SetGMFFile( h_data.myGMFFileName.c_str());
2310 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2311 QMapIterator<QString,QString> i(that->mySMPMap);
2312 while (i.hasNext()) {
2314 const QString entry = i.key();
2315 const QString sizeMap = i.value();
2317 if (sizeMap == "__TO_DELETE__") {
2318 h->UnsetEntry(entry.toLatin1().constData());
2320 else if (sizeMap.startsWith("ATTRACTOR")) {
2321 h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData());
2323 else if (sizeMap.startsWith("def")) {
2324 // h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
2327 if (!myATTMap[entry].empty()){
2328 const TAttractorVec& attVec = myATTMap[entry];
2329 for ( size_t i = 0; i < attVec.size(); ++i )
2331 if ( attVec[i].IsToDelete() )
2332 h->UnsetAttractorEntry( entry.toLatin1().constData(),
2333 attVec[i].attEntry.c_str() );
2335 h->SetClassAttractorEntry( entry.toLatin1().constData(),
2336 attVec[i].attEntry.c_str(),
2337 attVec[i].startSize,
2340 attVec[i].constDist );
2344 QString fullSizeMap;
2345 fullSizeMap = QString("");
2346 if (that->mySMPShapeTypeMap[entry] == TopAbs_FACE)
2347 fullSizeMap = QString("def f(u,v): return ") + sizeMap;
2348 else if (that->mySMPShapeTypeMap[entry] == TopAbs_EDGE)
2349 fullSizeMap = QString("def f(t): return ") + sizeMap;
2350 else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX)
2351 fullSizeMap = QString("def f(): return ") + sizeMap;
2352 h->SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() );
2357 // Enforced vertices
2360 std::string enfName;
2362 std::string groupName = "";
2365 TFaceEntryEnfVertexListMap::const_iterator evmIt = h_data.faceEntryEnfVertexListMap.begin();
2366 // 1. Clear all enforced vertices in hypothesis
2367 // 2. Add new enforced vertex according to h_data
2369 if ( h->GetAllEnforcedVertices()->length() > 0 )
2370 h->ClearAllEnforcedVertices();
2373 TEnfVertexList::const_iterator evsIt;
2374 for ( ; evmIt != h_data.faceEntryEnfVertexListMap.end() ; ++evmIt)
2376 faceEntry = evmIt->first;
2377 evs = evmIt->second;
2378 evsIt = evs.begin();
2379 for ( ; evsIt != evs.end() ; ++evsIt)
2382 if ((*evsIt)->coords.size()) {
2383 x = (*evsIt)->coords[0];
2384 y = (*evsIt)->coords[1];
2385 z = (*evsIt)->coords[2];
2388 h->SetEnforcedVertexEntry( faceEntry.c_str(), x, y, z, (*evsIt)->name.c_str(), (*evsIt)->geomEntry.c_str(), (*evsIt)->grpName.c_str());
2392 if ( h->GetInternalEnforcedVertexAllFaces() != h_data.myInternalEnforcedVerticesAllFaces )
2393 h->SetInternalEnforcedVertexAllFaces( h_data.myInternalEnforcedVerticesAllFaces );
2394 if ( h->GetInternalEnforcedVertexAllFacesGroup() != h_data.myInternalEnforcedVerticesAllFacesGroup )
2395 h->SetInternalEnforcedVertexAllFacesGroup( h_data.myInternalEnforcedVerticesAllFacesGroup.c_str() );
2398 if ( h->GetPreCadFacesPeriodicityVector()->length() > 0 || h->GetPreCadEdgesPeriodicityVector()->length() > 0 )
2399 h->ClearPreCadPeriodicityVectors();
2401 TPreCadPeriodicityVector::const_iterator pIt = h_data.preCadPeriodicityVector.begin();
2402 for ( ; pIt != h_data.preCadPeriodicityVector.end() ; ++pIt)
2404 TPreCadPeriodicity periodicity_i = *pIt;
2405 TEntry source = periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN];
2406 TEntry target = periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN];
2407 TEntry p1Source = periodicity_i[PERIODICITY_P1_SOURCE_COLUMN];
2408 TEntry p2Source = periodicity_i[PERIODICITY_P2_SOURCE_COLUMN];
2409 TEntry p3Source = periodicity_i[PERIODICITY_P3_SOURCE_COLUMN];
2410 TEntry p1Target = periodicity_i[PERIODICITY_P1_TARGET_COLUMN];
2411 TEntry p2Target = periodicity_i[PERIODICITY_P2_TARGET_COLUMN];
2412 TEntry p3Target = periodicity_i[PERIODICITY_P3_TARGET_COLUMN];
2413 bool onFace = (periodicity_i[PERIODICITY_SHAPE_TYPE]=="1") ? true : false;
2415 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2416 if (! p1Source.empty())
2418 sourceVertices->length(3);
2419 sourceVertices[0]=CORBA::string_dup(p1Source.c_str());
2420 sourceVertices[1]=CORBA::string_dup(p2Source.c_str());
2421 sourceVertices[2]=CORBA::string_dup(p3Source.c_str());
2425 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2426 if (! p1Target.empty())
2428 targetVertices->length(3);
2429 targetVertices[0]=CORBA::string_dup(p1Target.c_str());
2430 targetVertices[1]=CORBA::string_dup(p2Target.c_str());
2431 targetVertices[2]=CORBA::string_dup(p3Target.c_str());
2435 h->AddPreCadFacesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
2437 h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
2441 BLSURFPlugin::THyperPatchList_var hpl = new BLSURFPlugin::THyperPatchList();
2442 hpl->length( h_data.hyperpatches.size() );
2444 for ( int i = 0; i < h_data.hyperpatches.size(); ++i )
2446 QStringList tags = h_data.hyperpatches[i].split(" ", QString::SkipEmptyParts);
2447 BLSURFPlugin::THyperPatch& patch = hpl[ i ];
2448 patch.length( tags.size() );
2450 for ( int j = 0; j < tags.size(); ++j )
2451 patch[ j ] = tags[ j ].toDouble();
2453 h->SetHyperPatches( hpl );
2464 /** BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets(h_data)
2465 Stores the widgets content to the hypothesis data.
2467 QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const
2469 h_data.myName = myName ? myName->text() : "";
2470 h_data.myPhysicalMesh = myStdWidget->myPhysicalMesh->currentIndex();
2471 h_data.myGeometricMesh = myStdWidget->myGeometricMesh->currentIndex();
2472 h_data.myPhySize = myStdWidget->myPhySize->text().isEmpty() ? -1.0 : myStdWidget->myPhySize->GetValue();
2473 h_data.myPhySizeRel = myStdWidget->myPhySizeRel->isChecked();
2474 h_data.myMinSize = myStdWidget->myMinSize->text().isEmpty() ? -1.0 : myStdWidget->myMinSize->GetValue();
2475 h_data.myMinSizeRel = myStdWidget->myMinSizeRel->isChecked();
2476 h_data.myMaxSize = myStdWidget->myMaxSize->text().isEmpty() ? -1.0 : myStdWidget->myMaxSize->GetValue();
2477 h_data.myMaxSizeRel = myStdWidget->myMaxSizeRel->isChecked();
2478 h_data.myUseGradation = myStdWidget->myUseGradation->isChecked() && !myStdWidget->myGradation->text().isEmpty();
2479 h_data.myGradation = h_data.myUseGradation ? myStdWidget->myGradation->GetValue() : -1.0;
2480 h_data.myUseVolumeGradation = myStdWidget->myUseVolumeGradation->isChecked() && !myStdWidget->myVolumeGradation->text().isEmpty();
2481 h_data.myVolumeGradation = h_data.myUseVolumeGradation ? myStdWidget->myVolumeGradation->GetValue() : -1. ;
2482 h_data.myAllowQuadrangles = myStdWidget->myAllowQuadrangles->isChecked();
2483 h_data.myAngleMesh = myStdWidget->myAngleMesh->text().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue();
2484 h_data.myChordalError = myStdWidget->myChordalError->text().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue();
2485 h_data.myAnisotropic = myStdWidget->myAnisotropic->isChecked();
2486 h_data.myAnisotropicRatio = myStdWidget->myAnisotropicRatio->text().isEmpty() ? -1.0 : myStdWidget->myAnisotropicRatio->GetValue();
2487 h_data.myRemoveTinyEdges = myStdWidget->myRemoveTinyEdges->isChecked();
2488 h_data.myTinyEdgeLength = myStdWidget->myTinyEdgeLength->text().isEmpty() ? -1.0 : myStdWidget->myTinyEdgeLength->GetValue();
2489 h_data.myOptimiseTinyEdges = myStdWidget->myOptimiseTinyEdges->isChecked();
2490 h_data.myTinyEdgeOptimisLength = myStdWidget->myTinyEdgeOptimisLength->text().isEmpty() ? -1.0 : myStdWidget->myTinyEdgeOptimisLength->GetValue();
2491 h_data.myCorrectSurfaceIntersection = myStdWidget->myCorrectSurfaceIntersection->isChecked();
2492 h_data.myCorrectSurfaceIntersectionMaxCost = myStdWidget->myCorrectSurfaceIntersectionMaxCost->text().isEmpty() ? -1.0 : myStdWidget->myCorrectSurfaceIntersectionMaxCost->GetValue();
2493 h_data.myForceBadElementRemoval= myStdWidget->myForceBadElementRemoval->isChecked();
2494 h_data.myBadElementAspectRatio = myStdWidget->myBadElementAspectRatio->text().isEmpty() ? -1.0 : myStdWidget->myBadElementAspectRatio->GetValue();
2495 h_data.myOptimizeMesh = myStdWidget->myOptimizeMesh->isChecked();
2496 h_data.myQuadraticMesh = myStdWidget->myQuadraticMesh->isChecked();
2497 h_data.myVerbosity = myAdvWidget->myVerbosity->value();
2498 //h_data.myTopology = myAdvWidget->myPreCADGroupBox->isChecked() ? PreCAD : FromCAD;
2499 //h_data.myPreCADMergeEdges = myAdvWidget->myPreCADMergeEdges->isChecked();
2500 //h_data.myPreCADProcess3DTopology = myAdvWidget->myPreCADProcess3DTopology->isChecked();
2501 //h_data.myPreCADDiscardInput = myAdvWidget->myPreCADDiscardInput->isChecked();
2504 guiHyp += tr("BLSURF_PHY_MESH") + " = " + QString::number( h_data.myPhysicalMesh ) + "; ";
2505 guiHyp += tr("BLSURF_GEOM_MESH") + " = " + QString::number( h_data.myGeometricMesh ) + "; ";
2506 guiHyp += tr("BLSURF_HPHYDEF") + " = " + QString::number( h_data.myPhySize ) + "; ";
2507 guiHyp += tr("BLSURF_HPHYDEF") + " " + tr("BLSURF_SIZE_REL") +" = " + QString(h_data.myPhySizeRel ? "yes" : "no") + "; ";
2508 guiHyp += tr("BLSURF_MINSIZE") + " = "+ QString::number( h_data.myMinSize ) + "; ";
2509 guiHyp += tr("BLSURF_MINSIZE") + " " + tr("BLSURF_SIZE_REL") + " = " + QString(h_data.myMinSizeRel ? "yes" : "no") + "; ";
2510 guiHyp += tr("BLSURF_MAXSIZE") + " = "+ QString::number( h_data.myMaxSize ) + "; ";
2511 guiHyp += tr("BLSURF_MAXSIZE") + " " + tr("BLSURF_SIZE_REL") + " = " + QString(h_data.myMaxSizeRel ? "yes" : "no") + "; ";
2512 guiHyp += tr("BLSURF_GRADATION") + " = " + QString::number( h_data.myGradation ) + "; ";
2513 guiHyp += tr("BLSURF_ALLOW_QUADRANGLES") + " = " + QString(h_data.myAllowQuadrangles ? "yes" : "no") + "; ";
2514 guiHyp += tr("BLSURF_ANGLE_MESH") + " = " + QString::number( h_data.myAngleMesh ) + "; ";
2515 guiHyp += tr("BLSURF_CHORDAL_ERROR") + " = " + QString::number( h_data.myChordalError ) + "; ";
2516 guiHyp += tr("BLSURF_ANISOTROPIC") + " = " + QString(h_data.myAnisotropic ? "yes" : "no") + "; ";
2517 guiHyp += tr("BLSURF_ANISOTROPIC_RATIO") + " = " + QString::number( h_data.myAnisotropicRatio ) + "; ";
2520 guiHyp += tr("BLSURF_REMOVE_TINY_EDGES") + " = " + QString(h_data.myRemoveTinyEdges ? "yes" : "no") + "; ";
2521 guiHyp += tr("BLSURF_TINY_EDGES_LENGTH") + " = " + QString::number( h_data.myTinyEdgeLength ) + "; ";
2522 guiHyp += tr("BLSURF_REMOVE_SLIVERS") + " = " + QString(h_data.myForceBadElementRemoval ? "yes" : "no") + "; ";
2523 guiHyp += tr("BLSURF_BAD_SURFACE_ELEMENT_ASPECT_RATIO") + " = " + QString::number( h_data.myBadElementAspectRatio ) + "; ";
2524 guiHyp += tr("BLSURF_OPTIMISATION") + " = " + QString(h_data.myOptimizeMesh ? "yes" : "no") + "; ";
2525 guiHyp += tr("BLSURF_ELEMENT_ORDER") + " = " + QString(h_data.myQuadraticMesh ? "yes" : "no") + "; ";
2528 // guiHyp += tr("BLSURF_TOPOLOGY") + " = " + QString::number( h_data.myTopology ) + "; ";
2529 // guiHyp += tr("BLSURF_PRECAD_MERGE_EDGES") + " = " + QString(h_data.myPreCADMergeEdges ? "yes" : "no") + "; ";
2530 // guiHyp += tr("BLSURF_PRECAD_REMOVE_NANO_EDGES") + " = " + QString(h_data.myPreCADProcess3DTopology ? "yes" : "no") + "; ";
2531 // guiHyp += tr("BLSURF_PRECAD_DISCARD_INPUT") + " = " + QString(h_data.myPreCADDiscardInput ? "yes" : "no") + "; ";
2533 h_data.myGMFFileName = myAdvWidget->myGMFFileName->text().toStdString();
2534 // h_data.myGMFFileMode = myGMFFileMode->isChecked();
2537 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2538 int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
2539 for ( ; row < nbRows; ++row )
2541 QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
2542 if ( that->mySMPMap.contains(entry) )
2543 guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); ";
2546 // Enforced vertices
2547 h_data.enfVertexList.clear();
2548 h_data.faceEntryEnfVertexListMap.clear();
2550 int nbEnforcedShapes = myEnforcedTreeWidget->topLevelItemCount();
2551 std::string groupName = "", faceEntry = "";
2552 for (int i=0 ; i<nbEnforcedShapes ; i++)
2554 double childValueX,childValueY,childValueZ;
2555 std::string childName, vertexEntry;
2556 QTreeWidgetItem* child;
2558 child = myEnforcedTreeWidget->topLevelItem(i);
2559 childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
2560 childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
2561 childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
2562 childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
2563 vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
2564 // if (myGlobalGroupName->isChecked())
2565 // groupName = myGlobalGroupName->text().toStdString();
2567 groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString();
2569 TEnfVertex *enfVertex = new TEnfVertex();
2570 enfVertex->name = childName;
2571 if (vertexEntry.empty()) {
2572 enfVertex->coords.push_back(childValueX);
2573 enfVertex->coords.push_back(childValueY);
2574 enfVertex->coords.push_back(childValueZ);
2577 enfVertex->geomEntry = vertexEntry;
2578 enfVertex->grpName = groupName;
2579 // TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex);
2580 // if (it == h_data.enfVertexList.end())
2581 h_data.enfVertexList.insert(enfVertex);
2583 if (groupName != "")
2584 h_data.groupNameEnfVertexListMap[groupName].insert(vertex);
2586 h_data.faceEntryEnfVertexListMap[faceEntry].insert( enfVertex );
2589 h_data.myInternalEnforcedVerticesAllFaces = myInternalEnforcedVerticesAllFaces->isChecked();
2590 h_data.myInternalEnforcedVerticesAllFacesGroup = myInternalEnforcedVerticesAllFacesGroup->text().toStdString();
2593 h_data.preCadPeriodicityVector.clear();
2594 // For each tree item, store each value. Shapes are stored as entries.
2595 int nbPeriodicityDescriptions = myPeriodicityTreeWidget->topLevelItemCount();
2596 for (int i=0 ; i<nbPeriodicityDescriptions ; i++) {
2597 QTreeWidgetItem* item = myPeriodicityTreeWidget->topLevelItem(i);
2598 TPreCadPeriodicity periodicity_i;
2600 for (int k=0; k<myPeriodicityTreeWidget->columnCount(); ++k)
2602 std::string entry = item->data(k, Qt::UserRole).toString().toStdString();
2603 periodicity_i.push_back(entry);
2605 h_data.preCadPeriodicityVector.push_back(periodicity_i);
2607 guiHyp += "PERIODICITY = yes; ";
2611 h_data.hyperpatches.clear();
2612 for ( int row = 0; row < myHyPatchTable->rowCount(); ++row )
2613 h_data.hyperpatches.append( myHyPatchTable->item( row, 0 )->text() );
2618 void BLSURFPluginGUI_HypothesisCreator::onAddOption()
2620 myAdvWidget->AddOption( TBL_CUSTOM, NULL );
2623 void BLSURFPluginGUI_HypothesisCreator::onChangeOptionName( int row, int column )
2625 // if ( column != OPTION_NAME_COLUMN )
2627 // myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
2630 // **********************
2631 // *** BEGIN SIZE MAP ***
2632 // **********************
2634 void BLSURFPluginGUI_HypothesisCreator::onMapGeomContentModified()
2636 if ( myGeomSelWdg2->IsObjectSelected() ){
2637 mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
2639 else if ( myGeomSelWdg1->IsObjectSelected() ){
2640 mySMapObject = myGeomSelWdg1->GetObject< GEOM::GEOM_Object >(0);
2643 mySMapObject = GEOM::GEOM_Object::_nil();
2645 bool dataAvailable = !mySMapObject->_is_nil();
2647 if ( dataAvailable )
2648 qEntry = SMESH::toQStr( mySMapObject->GetStudyEntry() );
2650 bool mapExists = ( mySMPMap.contains(qEntry) && mySMPMap[qEntry] != "__TO_DELETE__" );
2651 if (( mapExists && myGeomSelWdg2->IsObjectSelected() ) &&
2652 ( dataAvailable = myAttSelWdg->isEnabled() ) &&
2653 ( dataAvailable = myAttSelWdg->IsObjectSelected() ) &&
2654 ( myATTMap.contains( qEntry )))
2657 QString attEntry = myAttSelWdg->GetValue();
2658 const TAttractorVec& attVec = myATTMap[ qEntry ];
2659 for ( size_t i = 0; i < attVec.size() && !mapExists; ++i )
2660 mapExists = ( attEntry == attVec[i].attEntry.c_str() );
2663 addMapButton->setEnabled( !mapExists && dataAvailable );
2664 modifyMapButton->setEnabled( mapExists && dataAvailable );
2667 void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item, int col)
2669 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2670 if (col == SMP_SIZEMAP_COLUMN) {
2671 QString entry = item->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
2673 if (!mySMPMap.contains(entry))
2675 if ( QTreeWidgetItem* parent = item->parent() )
2679 entry = item->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
2681 if (!mySMPMap.contains(entry))
2684 QString sizeMap = item->data( SMP_SIZEMAP_COLUMN, Qt::EditRole ).toString();
2685 CORBA::Object_var obj = entryToObject(entry);
2686 if (sizeMap.startsWith("Attractor") || sizeMap.startsWith("Constant")) { // ADVANCED MAPS
2687 smpTab->setCurrentIndex(ATT_TAB); // Change Tab
2688 // Retrieve values of the selected item in the current tab widgets
2689 const TAttractorVec& attVec = myATTMap[entry];
2690 if ( !attVec.empty() )
2693 if ( !childEntry.isEmpty() )
2694 for ( size_t i = 0; i < attVec.size(); ++i )
2695 if ( childEntry == attVec[i].attEntry.c_str() )
2700 double phySize = attVec[iAtt].startSize;
2701 double infDist = attVec[iAtt].infDist;
2702 double constDist = attVec[iAtt].constDist;
2703 QString attEntry = attVec[iAtt].attEntry.c_str();
2704 CORBA::Object_var attObj = entryToObject(attEntry);
2705 myAttSizeSpin->setValue(phySize);
2706 if ( infDist > std::numeric_limits<double>::epsilon() /*sizeMap.startsWith("Attractor")*/){
2707 myAttDistSpin->setValue(infDist);
2708 myAttractorCheck->setChecked(true);
2711 myAttractorCheck->setChecked(false);
2713 if (/*sizeMap.startsWith("Constant") || */constDist > std::numeric_limits<double>::epsilon()){
2714 myAttDistSpin2->setValue(constDist);
2715 myConstSizeCheck->setChecked(true);
2718 myConstSizeCheck->setChecked(false);
2720 myGeomSelWdg2->SetObject(obj);
2721 myAttSelWdg->SetObject(attObj);
2724 else { // CLASSIC MAPS
2725 smpTab->setCurrentIndex(SMP_STD_TAB); // Change Tab
2726 myGeomSelWdg1->SetObject(obj); // Retrieve values of the selected item in the current tab widgets
2727 if (!sizeMap.startsWith("def")){
2728 mySmpSizeSpin->setValue(that->mySMPMap[entry].toDouble());
2734 void BLSURFPluginGUI_HypothesisCreator::onTabChanged(int tab)
2736 getGeomSelectionTool()->selectionMgr()->clearFilters();
2737 if ( sender() == myTabWidget )
2739 myGeomSelWdg1 ->deactivateSelection();
2740 myGeomSelWdg2 ->deactivateSelection();
2741 myAttSelWdg ->deactivateSelection();
2742 myEnfVertexWdg ->deactivateSelection();
2743 myPeriodicitySourceFaceWdg->deactivateSelection();
2744 myPeriodicityTargetFaceWdg->deactivateSelection();
2745 myPeriodicityP1SourceWdg ->deactivateSelection();
2746 myPeriodicityP2SourceWdg ->deactivateSelection();
2747 myPeriodicityP3SourceWdg ->deactivateSelection();
2748 myPeriodicityP1TargetWdg ->deactivateSelection();
2749 myPeriodicityP2TargetWdg ->deactivateSelection();
2750 myPeriodicityP3TargetWdg ->deactivateSelection();
2751 if ( myHyPatchFaceSelBtn->isChecked() )
2752 myHyPatchFaceSelBtn->toggle();
2753 if ( myHyPatchGroupSelBtn->isChecked() )
2754 myHyPatchGroupSelBtn->toggle();
2757 else if ( sender() == smpTab )
2759 myAttDistSpin->setValue(0.); // Reinitialize widgets
2760 myAttSizeSpin->setValue(0.);
2761 myAttDistSpin2->setValue(0.);
2762 mySmpSizeSpin->setValue(0.);
2763 myGeomSelWdg1->deactivateSelection();
2764 myGeomSelWdg2->deactivateSelection();
2765 myAttSelWdg->deactivateSelection();
2766 myGeomSelWdg1->SetObject(CORBA::Object::_nil());
2767 myGeomSelWdg2->SetObject(CORBA::Object::_nil());
2768 myAttSelWdg->SetObject(CORBA::Object::_nil());
2769 myAttractorCheck->setChecked(false);
2770 myConstSizeCheck->setChecked(false);
2774 void BLSURFPluginGUI_HypothesisCreator::onAttractorClicked(int state)
2776 if (state == Qt::Checked){
2777 myAttSelWdg->setEnabled(true);
2778 myAttSizeSpin->setEnabled(true);
2779 myAttSizeLabel->setEnabled(true);
2780 myAttDistSpin->setEnabled(true);
2781 myAttDistLabel->setEnabled(true);
2782 if (!myAttSelWdg->IsObjectSelected()){
2783 myAttSelWdg->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }");
2786 if (state == Qt::Unchecked){
2787 myAttDistSpin->setEnabled(false);
2788 myAttDistLabel->setEnabled(false);
2789 myAttDistSpin->setValue(0.);
2790 if(myConstSizeCheck->checkState() == Qt::Unchecked){ // No predefined map selected
2791 myAttSelWdg->setEnabled(false);
2792 myAttSizeSpin->setEnabled(false);
2793 myAttSizeLabel->setEnabled(false);
2794 myAttDistSpin2->setEnabled(false);
2795 myAttDistLabel2->setEnabled(false);
2797 else if (!myAttSelWdg->IsObjectSelected()){ // Only constant size selected
2798 myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
2801 onMapGeomContentModified();
2804 void BLSURFPluginGUI_HypothesisCreator::onConstSizeClicked(int state)
2806 if (state == Qt::Checked){
2807 myAttSelWdg->setEnabled(true);
2808 myAttSizeSpin->setEnabled(true);
2809 myAttSizeLabel->setEnabled(true);
2810 myAttDistSpin2->setEnabled(true);
2811 myAttDistLabel2->setEnabled(true);
2812 if (myAttractorCheck->checkState() == Qt::Unchecked &&
2813 !myAttSelWdg->IsObjectSelected()){
2814 myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
2817 if (state == Qt::Unchecked){
2818 myAttDistSpin2->setEnabled(false);
2819 myAttDistLabel2->setEnabled(false);
2820 myAttDistSpin2->setValue(0.);
2821 if(myAttractorCheck->checkState() == Qt::Unchecked){ // No predefined map selected
2822 myAttSelWdg->setEnabled(false);
2823 myAttSizeSpin->setEnabled(false);
2824 myAttSizeLabel->setEnabled(false);
2825 myAttDistSpin->setEnabled(false);
2826 myAttDistLabel->setEnabled(false);
2828 else if (!myAttSelWdg->IsObjectSelected()){ // Only constant size selected
2829 myAttSelWdg->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }");
2832 onMapGeomContentModified();
2835 void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
2837 QList<int> selectedRows;
2838 QList<QTreeWidgetItem*> selected = mySizeMapTable->selectedItems();
2839 QTreeWidgetItem* item;
2840 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2842 qSort( selectedRows );
2843 QListIterator<QTreeWidgetItem*> it( selected );
2845 while ( it.hasPrevious() ) {
2846 item = it.previous();
2847 QString entry = item->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
2848 QString parentEntry;
2849 if ( QTreeWidgetItem* parent = item->parent() )
2850 parentEntry = parent->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
2851 if (that->mySMPMap.contains(entry))
2853 that->mySMPMap[entry] = "__TO_DELETE__";
2854 if ( myATTMap.contains( entry ))
2856 TAttractorVec& attVec = myATTMap[entry];
2857 for ( size_t i = 0; i < attVec.size(); ++i )
2858 attVec[i].SetToDelete();
2861 else if ( mySMPMap.contains( parentEntry ) && myATTMap.contains( parentEntry ))
2863 TAttractorVec& attVec = myATTMap[parentEntry];
2864 for ( size_t i = 0; i < attVec.size(); ++i )
2866 if ( entry == attVec[i].attEntry.c_str() )
2867 attVec[i].SetToDelete();
2870 if (that->mySMPShapeTypeMap.contains(entry))
2871 that->mySMPShapeTypeMap.remove(entry);
2872 // if (that->myDistMap.contains(entry))
2873 // that->myDistMap.remove(entry);
2874 // if (that->myAttDistMap.contains(entry))
2875 // that->myAttDistMap.remove(entry);
2878 mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN);
2879 mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
2882 void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(QTreeWidgetItem* item, int col)
2884 if (col == SMP_SIZEMAP_COLUMN) {
2885 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2886 QString entry = item->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
2887 QString sizeMap = item->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
2888 if (! that->mySMPShapeTypeMap.contains(entry))
2890 if (that->mySMPMap.contains(entry))
2891 if (that->mySMPMap[entry] == sizeMap
2892 || sizeMap.startsWith("Attractor")
2893 || sizeMap.startsWith("Constant") ){
2896 if (! sizeMap.isEmpty()) {
2897 that->mySMPMap[entry] = sizeMap;
2898 sizeMapValidationFromEntry(entry);
2901 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(that->mySMPMap[entry]) );
2903 mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
2907 void BLSURFPluginGUI_HypothesisCreator::onAddMap()
2910 if ( smpTab->currentIndex() == ATT_TAB ){
2911 if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){
2912 mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
2913 myAttObject = myAttSelWdg->GetObject< GEOM::GEOM_Object >(0);
2914 res = insertAttractor(mySMapObject, myAttObject);
2917 if (smpTab->currentIndex() == SMP_STD_TAB ){
2918 if ( myGeomSelWdg1->IsObjectSelected() ){
2919 mySMapObject = myGeomSelWdg1->GetObject< GEOM::GEOM_Object >(0);
2920 res = insertElement(mySMapObject);
2924 // Local size should be more than 0
2925 QString msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_SM_SIZE"));
2926 SUIT_MessageBox::critical( dlg(),"Error" , msg );
2929 getGeomSelectionTool()->selectionMgr()->clearFilters();
2930 myAttDistSpin->setValue(0.);
2931 myAttSizeSpin->setValue(0.);
2932 myAttDistSpin2->setValue(0.);
2933 mySmpSizeSpin->setValue(0.);
2934 myConstSizeCheck->setChecked(false);
2935 myAttractorCheck->setChecked(false);
2936 myGeomSelWdg1->deactivateSelection();
2937 myGeomSelWdg2->deactivateSelection();
2938 myAttSelWdg->deactivateSelection();
2939 myGeomSelWdg1->SetObject(CORBA::Object::_nil());
2940 myGeomSelWdg2->SetObject(CORBA::Object::_nil());
2941 myAttSelWdg->SetObject(CORBA::Object::_nil());
2944 void BLSURFPluginGUI_HypothesisCreator::onModifyMap()
2947 if ( smpTab->currentIndex() == ATT_TAB ){
2948 if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){
2949 mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
2950 myAttObject = myAttSelWdg->GetObject< GEOM::GEOM_Object >(0);
2951 res = insertAttractor(mySMapObject, myAttObject, /*modify = */true);
2954 if (smpTab->currentIndex() == SMP_STD_TAB ){
2955 if ( myGeomSelWdg1->IsObjectSelected() ){
2956 mySMapObject = myGeomSelWdg1->GetObject< GEOM::GEOM_Object >(0);
2957 res = insertElement(mySMapObject, /*modify = */true);
2961 // Local size should be more than 0
2962 QString msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_SM_SIZE"));
2963 SUIT_MessageBox::critical( dlg(),"Error" , msg );
2966 getGeomSelectionTool()->selectionMgr()->clearFilters();
2967 myAttDistSpin->setValue(0.);
2968 myAttSizeSpin->setValue(0.);
2969 myAttDistSpin2->setValue(0.);
2970 mySmpSizeSpin->setValue(0.);
2971 myConstSizeCheck->setChecked(false);
2972 myAttractorCheck->setChecked(false);
2973 myGeomSelWdg1->deactivateSelection();
2974 myGeomSelWdg2->deactivateSelection();
2975 myAttSelWdg->deactivateSelection();
2976 myGeomSelWdg1->SetObject(CORBA::Object::_nil());
2977 myGeomSelWdg2->SetObject(CORBA::Object::_nil());
2978 myAttSelWdg->SetObject(CORBA::Object::_nil());
2981 bool BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anObject, bool modify)
2983 // BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
2984 // BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
2986 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2988 TopAbs_ShapeEnum shapeType;
2989 string entry, shapeName;
2990 entry = (string) anObject->GetStudyEntry();
2991 shapeName = anObject->GetName();
2992 shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( anObject ).ShapeType();
2993 // Group management : the type of entities in the group is stored in the SMPShapeTypeMap
2994 // in order to write the size map with the right syntax in StoreParamsToHypo
2995 // (f(t) for edges, f(u,v) for faces ...)
2996 if (shapeType == TopAbs_COMPOUND){
2997 TopoDS_Shape theShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( anObject );
2998 TopoDS_Shape childShape;
2999 TopoDS_Iterator anIt(theShape);
3000 for(;anIt.More();anIt.Next()){
3001 childShape = anIt.Value();
3002 shapeType = childShape.ShapeType();
3003 if(!childShape.IsNull()){
3008 mySizeMapTable->setFocus();
3010 shapeEntry = QString::fromStdString(entry);
3011 double phySize = mySmpSizeSpin->value();
3014 return false; // Local size should be more than 0
3016 std::ostringstream oss;
3019 sizeMap = QString::fromStdString(oss.str());
3020 QTreeWidgetItem* item = new QTreeWidgetItem();
3022 int rowToChange = findRowFromEntry(shapeEntry);
3023 item = mySizeMapTable->topLevelItem( rowToChange );
3026 if (that->mySMPMap.contains(shapeEntry)) {
3027 if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
3031 mySizeMapTable->addTopLevelItem(item);
3033 that->mySMPMap[shapeEntry] = sizeMap;
3034 //that->myDistMap[shapeEntry] = 0. ;
3035 that->mySMPShapeTypeMap[shapeEntry] = shapeType;
3036 item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable |Qt::ItemIsEnabled );
3037 item->setData(SMP_ENTRY_COLUMN, Qt::EditRole, QVariant(shapeEntry) );
3038 item->setData(SMP_NAME_COLUMN, Qt::EditRole, QVariant(QString::fromStdString(shapeName)) );
3039 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(sizeMap) );
3040 mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
3041 mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
3042 mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
3043 mySizeMapTable->clearSelection();
3045 if ( myStdWidget->myPhysicalMesh->currentIndex() != PhysicalLocalSize ) {
3046 myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize );
3047 myStdWidget->onPhysicalMeshChanged();
3052 bool BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool modify)
3054 BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
3055 BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
3057 TopAbs_ShapeEnum shapeType;
3058 string entry, attEntry, faceName, attName;
3059 entry = (string) aFace->GetStudyEntry();
3060 attEntry = (string) anAttractor->GetStudyEntry();
3061 faceName = aFace->GetName();
3062 attName = anAttractor->GetName();
3063 shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aFace ).ShapeType();
3064 mySizeMapTable->setFocus();
3065 QString shapeEntry = QString::fromStdString(entry);
3066 QString qAttEntry = QString::fromStdString(attEntry);
3068 double phySize = h->GetPhySize();
3069 double infDist = 0. ;
3070 double constDist = 0. ;
3071 phySize = myAttSizeSpin->value();
3074 return false; // Local size should be more than 0
3076 if (myAttractorCheck->isChecked()){
3077 infDist = myAttDistSpin->value();
3079 if (myConstSizeCheck->isChecked()){
3080 constDist = myAttDistSpin2->value();
3082 std::ostringstream oss;
3083 std::ostringstream oss2;
3084 std::ostringstream oss3;
3088 QString sizeMap = QString::fromStdString(oss.str());
3089 QString infDistString = QString::fromStdString(oss2.str());
3090 QString constDistString = QString::fromStdString(oss3.str());
3092 QTreeWidgetItem* item;
3093 QTreeWidgetItem* child = 0;
3094 TAttractor attParams( attEntry.c_str(), phySize, infDist, constDist );
3096 int rowToChange = findRowFromEntry(shapeEntry);
3097 item = mySizeMapTable->topLevelItem( rowToChange );
3099 for ( int i = 0, nb = item->childCount(); i < nb; ++i )
3100 if (( child = item->child( i )))
3101 if ( qAttEntry == child->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString() )
3103 TAttractorVec & attVec = myATTMap[shapeEntry];
3104 for ( size_t i = 0; i < attVec.size(); ++i )
3105 if ( attVec[i].attEntry == attEntry )
3107 attVec[i] = attParams;
3112 // if (that->mySMPMap.contains(shapeEntry)) {
3113 // if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
3117 int rowToChange = findRowFromEntry(shapeEntry);
3118 if ( rowToChange < mySizeMapTable->topLevelItemCount() )
3120 item = mySizeMapTable->topLevelItem( rowToChange );
3123 item = new QTreeWidgetItem();
3124 mySizeMapTable->addTopLevelItem(item);
3126 child = new QTreeWidgetItem();
3127 item->addChild(child);
3128 bool exists = false;
3129 TAttractorVec & attVec = myATTMap[shapeEntry];
3130 for ( size_t i = 0; i < attVec.size(); ++i )
3131 if ( attVec[i].attEntry == attEntry )
3133 attVec[i] = attParams;
3138 myATTMap[shapeEntry].push_back( attParams );
3140 mySMPMap.insert(shapeEntry,sizeMap);
3141 mySMPShapeTypeMap.insert(shapeEntry,shapeType);
3142 item->setExpanded(true);
3143 item->setData(SMP_ENTRY_COLUMN, Qt::EditRole, QVariant(shapeEntry) );
3144 item->setData(SMP_NAME_COLUMN, Qt::EditRole, QVariant(QString::fromStdString(faceName)) );
3145 if (infDist > std::numeric_limits<double>::epsilon()){
3146 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(QString::fromStdString("Attractor")) );
3148 else if (constDist > std::numeric_limits<double>::epsilon()){
3149 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(QString::fromStdString("Constant Size")) );
3151 item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable |Qt::ItemIsEnabled );
3153 child->setData(SMP_ENTRY_COLUMN, Qt::EditRole, QVariant(qAttEntry) );
3154 child->setData(SMP_NAME_COLUMN, Qt::EditRole, QVariant(QString::fromStdString(attName)) );
3155 child->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(sizeMap) );
3157 mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
3158 mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
3159 mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
3161 if ( myStdWidget->myPhysicalMesh->currentIndex() != PhysicalLocalSize ) {
3162 myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize );
3163 myStdWidget->onPhysicalMeshChanged();
3168 bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()
3170 int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
3171 for ( ; row < nbRows; ++row )
3172 if (! sizeMapValidationFromRow(row))
3177 bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool displayError)
3179 QString myEntry = mySizeMapTable->topLevelItem( myRow )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
3180 bool res = sizeMapValidationFromEntry(myEntry,displayError);
3181 mySizeMapTable->setFocus();
3185 bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEntry, bool displayError)
3188 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
3190 if (! that->mySMPMap.contains(myEntry)) {
3193 if (! that->mySMPShapeTypeMap.contains(myEntry)) {
3199 if (that->mySMPMap[myEntry].startsWith("def")) {
3200 expr = that->mySMPMap[myEntry].toStdString();
3202 else if (that->mySMPMap[myEntry].startsWith("ATTRACTOR")) {
3203 if ((that->mySMPMap[myEntry].count(QRegExp("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$")) != 1)) {
3206 SUIT_MessageBox::warning( dlg(),"Definition of attractor : Error" ,"An attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False[;d])" );
3212 // case size map is empty
3213 if (that->mySMPMap[myEntry].isEmpty()) {
3215 SUIT_MessageBox::warning( dlg(),"Definition of size map : Error" , "Size map can't be empty");
3219 if ( that->mySMPShapeTypeMap[myEntry] == TopAbs_FACE)
3220 expr = "def f(u,v) : return " + that->mySMPMap[myEntry].toStdString();
3221 else if ( that->mySMPShapeTypeMap[myEntry] == TopAbs_EDGE)
3222 expr = "def f(t) : return " + that->mySMPMap[myEntry].toStdString();
3223 else if ( that->mySMPShapeTypeMap[myEntry] == TopAbs_VERTEX)
3224 expr = "def f() : return " + that->mySMPMap[myEntry].toStdString();
3227 //assert(Py_IsInitialized());
3228 if (! Py_IsInitialized())
3229 throw ("Erreur: Python interpreter is not initialized");
3230 PyGILState_STATE gstate;
3231 gstate = PyGILState_Ensure();
3233 string err_description="";
3234 PyObject* obj= PyRun_String(expr.c_str(), Py_file_input, main_dict, NULL);
3238 PyObject* new_stderr = newPyStdOut(err_description);
3239 PyObject* old_stderr = PySys_GetObject((char*)"stderr");
3240 Py_INCREF(old_stderr);
3241 PySys_SetObject((char*)"stderr", new_stderr);
3243 PySys_SetObject((char*)"stderr", old_stderr);
3244 Py_DECREF(new_stderr);
3246 SUIT_MessageBox::warning( dlg(),"Definition of Python Function : Error" ,err_description.c_str() );
3247 PyGILState_Release(gstate);
3252 PyObject* func = PyObject_GetAttrString(main_mod, "f");
3256 PyObject* new_stderr = newPyStdOut(err_description);
3257 PyObject* old_stderr = PySys_GetObject((char*)"stderr");
3258 Py_INCREF(old_stderr);
3259 PySys_SetObject((char*)"stderr", new_stderr);
3261 PySys_SetObject((char*)"stderr", old_stderr);
3262 Py_DECREF(new_stderr);
3264 SUIT_MessageBox::warning( dlg(),"Python Error" ,err_description.c_str() );
3265 PyGILState_Release(gstate);
3269 PyGILState_Release(gstate);
3275 //================================================================================
3277 * \brief SLOT: Activate selection of faces in the Viewer
3279 //================================================================================
3281 void BLSURFPluginGUI_HypothesisCreator::onHyPatchFaceSelection(bool on)
3283 if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
3285 QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
3286 QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
3287 myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
3289 myHyPatchFaceSelector->setVisible( on ); // show its buttons
3290 myHyPatchFaceSelector->ShowPreview( on ); // show faces in the Viewer
3291 // treat selection or not
3292 myHyPatchFaceSelector->ActivateSelection( on || myHyPatchGroupSelBtn->isChecked() );
3295 myHyPatchGroupSelBtn->setChecked( false );
3298 //================================================================================
3300 * \brief SLOT: Deactivate selection of faces in the Viewer
3302 //================================================================================
3304 void BLSURFPluginGUI_HypothesisCreator::onHyPatchGroupSelection(bool on)
3306 if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
3308 QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
3309 QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
3310 myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
3312 if ( !myHyPatchFaceSelBtn->isChecked() )
3314 myHyPatchFaceSelector->setVisible( false ); // show its buttons
3315 myHyPatchFaceSelector->ShowPreview( false ); // show faces in the Viewer
3317 // treat selection or not
3318 myHyPatchFaceSelector->ActivateSelection( on || myHyPatchFaceSelBtn->isChecked() );
3321 myHyPatchFaceSelBtn->setChecked( false );
3324 //================================================================================
3326 * \brief SLOT: show IDs of selected faces in Tags LineEdit
3328 //================================================================================
3330 void BLSURFPluginGUI_HypothesisCreator::onHyPatchSelectionChanged()
3333 const QList<int>& tags = myHyPatchFaceSelector->GetSelectedIDs();
3334 for ( int i = 0; i < tags.size(); ++i )
3335 tagString += QString::number( tags[i] ) + " ";
3337 myHyPatchTagsLE->setText( tagString );
3340 //================================================================================
3342 * \brief SLOT: Add the Tags to the HyperPatch table
3344 //================================================================================
3346 void BLSURFPluginGUI_HypothesisCreator::onHyPatchAdd()
3348 QStringList tagList = myHyPatchTagsLE->text().split(" ", QString::SkipEmptyParts);
3349 if ( tagList.size() > 1 )
3351 addHyPatchToTable( myHyPatchTagsLE->text() );
3352 myHyPatchTagsLE->setText("");
3356 //================================================================================
3358 * \brief Add a row to myHyPatchTable
3360 //================================================================================
3362 void BLSURFPluginGUI_HypothesisCreator::addHyPatchToTable(const QString& tags)
3364 if ( tags.isEmpty() ) return;
3366 QTableWidgetItem* cell = new QTableWidgetItem( tags );
3367 cell->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
3369 int row = myHyPatchTable->rowCount();
3370 myHyPatchTable->insertRow( row );
3371 myHyPatchTable->setItem( row, 0, cell );
3374 //================================================================================
3376 * \brief SLOT: remove selected rows from the HyperPatch table
3378 //================================================================================
3380 void BLSURFPluginGUI_HypothesisCreator::onHyPatchRemove()
3382 QList<QTableWidgetItem *> items = myHyPatchTable->selectedItems();
3383 while ( !items.isEmpty() )
3385 myHyPatchTable->removeRow( items[0]->row() );
3386 items = myHyPatchTable->selectedItems();
3390 QString BLSURFPluginGUI_HypothesisCreator::caption() const
3392 return tr( "BLSURF_TITLE" );
3395 QPixmap BLSURFPluginGUI_HypothesisCreator::icon() const
3397 return SUIT_Session::session()->resourceMgr()->loadPixmap( "BLSURFPlugin", tr( "ICON_DLG_BLSURF_PARAMETERS") );
3400 QString BLSURFPluginGUI_HypothesisCreator::type() const
3402 return tr( "BLSURF_HYPOTHESIS" );
3405 QString BLSURFPluginGUI_HypothesisCreator::helpPage() const
3407 return "blsurf_hypo_page.html";
3410 LightApp_SelectionMgr* BLSURFPluginGUI_HypothesisCreator::selectionMgr()
3413 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
3415 return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
3420 CORBA::Object_var BLSURFPluginGUI_HypothesisCreator::entryToObject(QString entry)
3422 SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
3423 SALOMEDS::Study_var myStudy = smeshGen_i->GetCurrentStudy();
3424 CORBA::Object_var obj;
3425 SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.toStdString().c_str() );
3426 if (!aSObj->_is_nil()) {
3427 obj = aSObj->GetObject();
3428 aSObj->UnRegister();
3433 int BLSURFPluginGUI_HypothesisCreator::findRowFromEntry(QString entry){
3434 int endRow = mySizeMapTable->topLevelItemCount()-1;
3436 for ( ; row <= endRow; ++row )
3438 QString entryForChecking = mySizeMapTable->topLevelItem( row )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
3439 if (entry == entryForChecking )