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"
29 #include "BLSURFPlugin_Hypothesis.hxx"
31 #include <GeometryGUI.h>
33 #include <SMESHGUI_Dialog.h>
34 #include <SMESHGUI_HypothesesUtils.h>
35 #include <SMESHGUI_IdValidator.h>
36 #include <SMESHGUI_SpinBox.h>
37 #include <SMESHGUI_Utils.h>
38 #include <SMESH_Gen_i.hxx>
39 #include <SMESH_NumberFilter.hxx>
40 #include <StdMeshersGUI_SubShapeSelectorWdg.h>
42 #include <LightApp_SelectionMgr.h>
43 #include <SALOME_ListIO.hxx>
44 #include <SUIT_MessageBox.h>
45 #include <SUIT_ResourceMgr.h>
46 #include <SUIT_Session.h>
47 #include <SalomeApp_Application.h>
48 #include <SalomeApp_Tools.h>
50 #include <QApplication>
54 #include <QGridLayout>
56 #include <QHBoxLayout>
57 #include <QHeaderView>
61 #include <QModelIndexList>
63 #include <QPushButton>
64 #include <QRadioButton>
67 #include <QStandardItem>
68 #include <QStandardItemModel>
70 #include <QTableWidget>
71 #include <QTreeWidget>
72 #include <QTreeWidgetItem>
73 #include <QVBoxLayout>
75 #include <TopoDS_Shape.hxx>
76 #include <TopoDS_Iterator.hxx>
78 #include <structmember.h> // Python
96 TBL_MESHING = 0, TBL_PRECAD, TBL_CUSTOM,
98 // Enforced vertices array columns
99 ENF_VER_NAME_COLUMN = 0,
100 ENF_VER_FACE_ENTRY_COLUMN,
104 ENF_VER_ENTRY_COLUMN,
105 ENF_VER_GROUP_COLUMN,
108 PERIODICITY_OBJ_SOURCE_COLUMN = 0,
109 PERIODICITY_OBJ_TARGET_COLUMN,
110 PERIODICITY_P1_SOURCE_COLUMN,
111 PERIODICITY_P2_SOURCE_COLUMN,
112 PERIODICITY_P3_SOURCE_COLUMN,
113 PERIODICITY_P1_TARGET_COLUMN,
114 PERIODICITY_P2_TARGET_COLUMN,
115 PERIODICITY_P3_TARGET_COLUMN,
116 PERIODICITY_SHAPE_TYPE,
118 // PERIODICITY_OBJ_SOURCE_COLUMN = 0,
119 // PERIODICITY_ENTRY_SOURCE_COLUMN,
120 // PERIODICITY_OBJ_TARGET_COLUMN,
121 // PERIODICITY_ENTRY_TARGET_COLUMN,
122 // PERIODICITY_P1_SOURCE_COLUMN,
123 // PERIODICITY_P1_ENTRY_SOURCE_COLUMN,
124 // PERIODICITY_P2_SOURCE_COLUMN,
125 // PERIODICITY_P2_ENTRY_SOURCE_COLUMN,
126 // PERIODICITY_P3_SOURCE_COLUMN,
127 // PERIODICITY_P3_ENTRY_SOURCE_COLUMN,
128 // PERIODICITY_P1_TARGET_COLUMN,
129 // PERIODICITY_P1_ENTRY_TARGET_COLUMN,
130 // PERIODICITY_P2_TARGET_COLUMN,
131 // PERIODICITY_P2_ENTRY_TARGET_COLUMN,
132 // PERIODICITY_P3_TARGET_COLUMN,
133 // PERIODICITY_P3_ENTRY_TARGET_COLUMN,
135 PERIODICITY_NB_COLUMN
161 // Enforced vertices inputs
169 // ENF_VER_GROUP_CHECK,
173 ENF_VER_INTERNAL_ALL_FACES,
174 ENF_VER_INTERNAL_ALL_FACES_GROUP,
175 // ENF_VER_VERTEX_BTN,
176 // ENF_VER_REMOVE_BTN,
177 // ENF_VER_SEPARATOR,
182 /**************************************************
183 Begin initialization Python structures and objects
184 ***************************************************/
194 PyStdOut_dealloc(PyStdOut *self)
200 PyStdOut_write(PyStdOut *self, PyObject *args)
204 if (!PyArg_ParseTuple(args, "t#:write",&c, &l))
207 *(self->out)=*(self->out)+c;
213 static PyMethodDef PyStdOut_methods[] = {
214 {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
215 PyDoc_STR("write(string) -> None")},
216 {NULL, NULL} /* sentinel */
219 static PyMemberDef PyStdOut_memberlist[] = {
220 {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
221 (char*)"flag indicating that a space needs to be printed; used by print"},
222 {NULL} /* Sentinel */
225 static PyTypeObject PyStdOut_Type = {
226 /* The ob_type field must be initialized in the module init function
227 * to be portable to Windows without using C++. */
228 PyObject_HEAD_INIT(NULL)
231 sizeof(PyStdOut), /*tp_basicsize*/
234 (destructor)PyStdOut_dealloc, /*tp_dealloc*/
241 0, /*tp_as_sequence*/
246 PyObject_GenericGetAttr, /*tp_getattro*/
247 /* softspace is writable: we must supply tp_setattro */
248 PyObject_GenericSetAttr, /* tp_setattro */
250 Py_TPFLAGS_DEFAULT, /*tp_flags*/
254 0, /*tp_richcompare*/
255 0, /*tp_weaklistoffset*/
258 PyStdOut_methods, /*tp_methods*/
259 PyStdOut_memberlist, /*tp_members*/
273 PyObject * newPyStdOut( std::string& out )
275 PyStdOut* self = PyObject_New(PyStdOut, &PyStdOut_Type);
280 return (PyObject*)self;
284 /*************************************************
285 End initialization Python structures and objects
286 **************************************************/
290 // BEGIN EnforcedTreeWidgetDelegate
293 EnforcedTreeWidgetDelegate::EnforcedTreeWidgetDelegate(QObject *parent)
294 : QItemDelegate(parent)
298 QWidget *EnforcedTreeWidgetDelegate::createEditor(QWidget *parent,
299 const QStyleOptionViewItem & option ,
300 const QModelIndex & index ) const
302 QModelIndex father = index.parent();
303 QString entry = father.child(index.row(), ENF_VER_ENTRY_COLUMN).data(Qt::EditRole).toString();
305 if (index.column() == ENF_VER_X_COLUMN || \
306 index.column() == ENF_VER_Y_COLUMN || \
307 index.column() == ENF_VER_Z_COLUMN)
309 SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
310 editor->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
311 editor->setReadOnly(!entry.isEmpty());
312 editor->setDisabled(!entry.isEmpty());
317 QLineEdit *editor = new QLineEdit(parent);
318 if (index.column() != ENF_VER_GROUP_COLUMN) {
319 editor->setReadOnly(!entry.isEmpty());
320 editor->setDisabled(!entry.isEmpty());
326 void EnforcedTreeWidgetDelegate::setEditorData(QWidget *editor,
327 const QModelIndex &index) const
329 QString value = index.model()->data(index, Qt::EditRole).toString();
331 if (index.column() == ENF_VER_X_COLUMN ||
332 index.column() == ENF_VER_Y_COLUMN ||
333 index.column() == ENF_VER_Z_COLUMN)
335 SMESHGUI_SpinBox *lineEdit = static_cast<SMESHGUI_SpinBox*>(editor);
336 lineEdit->setText(value);
339 QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
340 lineEdit->setText(value);
344 void EnforcedTreeWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
345 const QModelIndex &index) const
347 QModelIndex parent = index.parent();
348 QString entry = parent.child(index.row(), ENF_VER_ENTRY_COLUMN).data(Qt::EditRole).toString();
349 if (index.column() == ENF_VER_X_COLUMN || index.column() == ENF_VER_Y_COLUMN || index.column() == ENF_VER_Z_COLUMN) {
350 SMESHGUI_SpinBox *lineEdit = static_cast<SMESHGUI_SpinBox*>(editor);
351 if (entry.isEmpty() && !vertexExists(model, index, lineEdit->GetString()))
352 model->setData(index, lineEdit->GetValue(), Qt::EditRole);
353 } else if (index.column() == ENF_VER_NAME_COLUMN) {
354 QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
355 QString value = lineEdit->text();
356 if (entry.isEmpty() && !vertexExists(model, index, value))
357 model->setData(index, value, Qt::EditRole);
358 } else if (index.column() == ENF_VER_ENTRY_COLUMN) {
359 QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
360 QString value = lineEdit->text();
361 if (!vertexExists(model, index, value))
362 model->setData(index, value, Qt::EditRole);
363 } else if (index.column() == ENF_VER_GROUP_COLUMN) {
364 QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
365 model->setData(index, lineEdit->text(), Qt::EditRole);
369 void EnforcedTreeWidgetDelegate::updateEditorGeometry(QWidget *editor,
370 const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
372 editor->setGeometry(option.rect);
375 bool EnforcedTreeWidgetDelegate::vertexExists(QAbstractItemModel *model,
376 const QModelIndex &index, QString value) const
379 QModelIndex parent = index.parent();
380 int row = index.row();
381 int col = index.column();
383 if (parent.isValid() && !value.isEmpty()) {
384 if (col == ENF_VER_X_COLUMN || col == ENF_VER_Y_COLUMN || col == ENF_VER_Z_COLUMN) {
386 if (col == ENF_VER_X_COLUMN) {
387 x = value.toDouble();
388 y = parent.child(row, ENF_VER_Y_COLUMN).data(Qt::EditRole).toDouble();
389 z = parent.child(row, ENF_VER_Z_COLUMN).data(Qt::EditRole).toDouble();
391 if (col == ENF_VER_Y_COLUMN) {
392 y = value.toDouble();
393 x = parent.child(row, ENF_VER_X_COLUMN).data(Qt::EditRole).toDouble();
394 z = parent.child(row, ENF_VER_Z_COLUMN).data(Qt::EditRole).toDouble();
396 if (col == ENF_VER_Z_COLUMN) {
397 z = value.toDouble();
398 x = parent.child(row, ENF_VER_X_COLUMN).data(Qt::EditRole).toDouble();
399 y = parent.child(row, ENF_VER_Y_COLUMN).data(Qt::EditRole).toDouble();
401 int nbChildren = model->rowCount(parent);
402 for (int i = 0 ; i < nbChildren ; i++) {
404 double childX = parent.child(i, ENF_VER_X_COLUMN).data(Qt::EditRole).toDouble();
405 double childY = parent.child(i, ENF_VER_Y_COLUMN).data(Qt::EditRole).toDouble();
406 double childZ = parent.child(i, ENF_VER_Z_COLUMN).data(Qt::EditRole).toDouble();
407 if ((childX == x) && (childY == y) && (childZ == z)) {
414 else if (col == ENF_VER_NAME_COLUMN) {
415 int nbChildren = model->rowCount(parent);
416 for (int i = 0 ; i < nbChildren ; i++) {
418 QString childName = parent.child(i, ENF_VER_NAME_COLUMN).data(Qt::EditRole).toString();
419 if (childName == value) {
432 // END EnforcedTreeWidgetDelegate
437 * \brief {BLSURFPluginGUI_HypothesisCreator constructor}
438 * @param theHypType Name of the hypothesis type (here BLSURF_Parameters)
441 BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QString& theHypType )
442 : SMESHGUI_GenericHypothesisCreator( theHypType )
444 this->mySMPMap.clear();
446 GeomToolSelected = NULL;
447 GeomToolSelected = getGeomSelectionTool();
449 aSel = GeomToolSelected->selectionMgr();
451 /* Initialize the Python interpreter */
452 if (! Py_IsInitialized())
453 throw ("Error: Python interpreter is not initialized");
454 PyGILState_STATE gstate;
455 gstate = PyGILState_Ensure();
458 main_mod = PyImport_AddModule("__main__");
461 main_dict = PyModule_GetDict(main_mod);
463 PyRun_SimpleString("from math import *");
464 PyGILState_Release(gstate);
468 BLSURFPluginGUI_HypothesisCreator::~BLSURFPluginGUI_HypothesisCreator()
473 * \brief {Get or create the geom selection tool for active study}
475 GeomSelectionTools* BLSURFPluginGUI_HypothesisCreator::getGeomSelectionTool() const
477 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
478 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
479 if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
480 that->GeomToolSelected = new GeomSelectionTools(aStudy);
482 return that->GeomToolSelected;
485 GEOM::GEOM_Gen_var BLSURFPluginGUI_HypothesisCreator::getGeomEngine()
487 return GeometryGUI::GetGeomGen();
490 void BLSURFPluginGUI_HypothesisCreator::avoidSimultaneousSelection(ListOfWidgets &selectionWidgets) const
492 StdMeshersGUI_ObjectReferenceParamWdg* widgetToActivate = 0;
493 ListOfWidgets::const_iterator anIt = selectionWidgets.begin();
494 for ( ; anIt != selectionWidgets.end(); anIt++)
496 if ( *anIt && (*anIt)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
498 StdMeshersGUI_ObjectReferenceParamWdg * w1 =
499 ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
500 ListOfWidgets::const_iterator anIt2 = anIt;
501 for ( ++anIt2; anIt2 != selectionWidgets.end(); anIt2++)
502 if ( *anIt2 && (*anIt2)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
504 StdMeshersGUI_ObjectReferenceParamWdg * w2 =
505 ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt2 );
506 w1->AvoidSimultaneousSelection( w2 );
508 if ( !widgetToActivate )
509 widgetToActivate = w1;
512 if ( widgetToActivate )
513 widgetToActivate->activateSelection();
516 bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
520 BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
521 BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
525 myAdvWidget->myOptionTable->setFocus();
526 QApplication::instance()->processEvents();
530 int iTbl = 0, nbTbl = myAdvWidget->myOptionTable->topLevelItemCount();
531 for ( ; iTbl < nbTbl; ++iTbl )
533 QTreeWidgetItem* table = myAdvWidget->myOptionTable->topLevelItem( iTbl );
534 int nbRows = table->childCount();
535 for ( int iRow = 0; iRow < nbRows; ++iRow )
537 QTreeWidgetItem* row = table->child( iRow );
538 myAdvWidget->GetOptionAndValue( row, name, value, isDefault );
540 if ( name.simplified().isEmpty() )
541 continue; // invalid custom option
543 if ( isDefault ) // not selected option
550 h->SetOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
553 h->SetPreCADOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
556 h->AddOption( name.toLatin1().constData(), value.toLatin1().constData() );
560 catch ( const SALOME::SALOME_Exception& ex )
562 msg = ex.details.text.in();
571 h->SetOptionValues( myOptions ); // restore values
572 h->SetPreCADOptionValues( myPreCADOptions ); // restore values
576 // SizeMap and attractors
579 mySizeMapTable->setFocus();
580 QApplication::instance()->processEvents();
582 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
583 int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
585 for ( ; row < nbRows; ++row )
587 QString entry = mySizeMapTable->topLevelItem( row )->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
588 QString sizeMap = mySizeMapTable->topLevelItem( row )->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
589 if ( !sizeMap.isEmpty() ) {
590 if (that->sizeMapValidationFromRow(row))
593 e = entry.toStdString();
594 s = that->mySMPMap[entry].toStdString();
595 h->SetSizeMapEntry( e.c_str(), s.c_str() );
597 catch ( const SALOME::SALOME_Exception& ex )
599 msg = ex.details.text.in();
610 // 22207: BLSURFPLUGIN: The user is allowed to enter 0 as a global or local size.
613 // In case if not STD_TAB is current tab, then text() of empty spinboxes returns "0" value.
614 // So STD_TAB must be current tab to get correct value of it's spinbox.
615 myTabWidget->setCurrentIndex( STD_TAB );
619 if ( !( ok = ( myStdWidget->myPhySize->text().isEmpty() ||
620 myStdWidget->myPhySize->text().toDouble() > 0.0 )))
621 msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_HPHYDEF"));
625 if ( !( ok = ( myStdWidget->myMaxSize->text().isEmpty() ||
626 myStdWidget->myMaxSize->text().toDouble() > 0.0 )))
627 msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_MAXSIZE"));
631 if ( !( ok = ( myStdWidget->myAngleMesh->text().isEmpty() ||
632 myStdWidget->myAngleMesh->text().toDouble() > 0.0 )))
633 msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_ANGLE_MESH"));
637 if ( !( ok = ( myStdWidget->myChordalError->text().isEmpty() ||
638 myStdWidget->myChordalError->text().toDouble() > 0.0 )))
639 msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_CHORDAL_ERROR"));
648 QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
650 QFrame* fr = new QFrame( 0 );
651 QVBoxLayout* lay = new QVBoxLayout( fr );
653 lay->setSpacing( 0 );
655 // main TabWidget of the dialog
656 myTabWidget = new QTabWidget( fr );
657 myTabWidget->setTabShape( QTabWidget::Rounded );
658 myTabWidget->setTabPosition( QTabWidget::North );
659 lay->addWidget( myTabWidget );
664 myStdGroup = new QWidget();
665 QGridLayout* aStdLayout = new QGridLayout( myStdGroup );
666 aStdLayout->setSpacing( 6 );
667 aStdLayout->setMargin( 11 );
670 myName = new QLineEdit( myStdGroup );
671 myStdWidget = new BLSURFPluginGUI_StdWidget(myStdGroup);
673 myStdWidget->myPhysicalMesh->removeItem( PhysicalLocalSize );
678 aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), 0, 0, 1, 1 );
679 aStdLayout->addWidget( myName, row++, 1, 1, 3 );
681 aStdLayout->addWidget( myStdWidget, row++, 0, 1, 4 );
686 aStdLayout->setRowStretch(row,1);
687 aStdLayout->setColumnStretch(1,1);
690 // advanced parameters
691 myAdvGroup = new QWidget();
692 QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup );
693 anAdvLayout->setSpacing( 6 );
694 anAdvLayout->setMargin( 11 );
695 myAdvWidget = new BLSURFPluginGUI_AdvWidget(myAdvGroup);
696 anAdvLayout->addWidget( myAdvWidget );
699 // Size Maps parameters
701 mySmpGroup = new QWidget( dlg() );
704 QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
707 mySizeMapTable = new QTreeWidget( mySmpGroup );
708 mySizeMapTable ->setMinimumWidth(200);
709 QStringList sizeMapHeaders;
710 sizeMapHeaders << tr( "SMP_NAME_COLUMN" )<< tr( "SMP_SIZEMAP_COLUMN" )<< tr( "SMP_ENTRY_COLUMN" );// << tr( "SMP_DIST_COLUMN" );
711 mySizeMapTable->setHeaderLabels(sizeMapHeaders);
712 mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN);
713 mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
714 mySizeMapTable->hideColumn(SMP_ENTRY_COLUMN);
715 mySizeMapTable->setAlternatingRowColors(true);
718 smpTab = new QTabWidget( mySmpGroup );
719 smpTab->setTabShape( QTabWidget::Rounded );
720 smpTab->setTabPosition( QTabWidget::South );
721 lay->addWidget( smpTab );
723 // Filters of selection
724 TColStd_MapOfInteger SM_ShapeTypes, ATT_ShapeTypes;
726 SM_ShapeTypes.Add( TopAbs_VERTEX );
727 SM_ShapeTypes.Add( TopAbs_EDGE );
728 SM_ShapeTypes.Add( TopAbs_FACE );
729 SM_ShapeTypes.Add( TopAbs_COMPOUND );
731 ATT_ShapeTypes.Add( TopAbs_VERTEX );
732 ATT_ShapeTypes.Add( TopAbs_EDGE );
733 ATT_ShapeTypes.Add( TopAbs_WIRE );
734 ATT_ShapeTypes.Add( TopAbs_COMPOUND );
736 SMESH_NumberFilter* myFilter1 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, SM_ShapeTypes);
737 SMESH_NumberFilter* myFilter2 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, ATT_ShapeTypes);
738 SMESH_NumberFilter* myFilter3 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, TopAbs_FACE);
740 // Standard size map tab
741 mySmpStdGroup = new QWidget();
742 QGridLayout* anSmpStdLayout = new QGridLayout(mySmpStdGroup);
743 myGeomSelWdg1 = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter1, 0, /*multiSel=*/false);
744 myGeomSelWdg1->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
745 mySmpSizeSpin = new SMESHGUI_SpinBox(mySmpStdGroup);
746 mySmpSizeSpin->RangeStepAndValidator(0., COORD_MAX, 1.0, "length_precision");
747 QLabel* mySmpSizeLabel = new QLabel(tr("BLSURF_SM_SIZE"),mySmpStdGroup);
750 myAttractorGroup = new QWidget();
751 QGridLayout* anAttLayout = new QGridLayout(myAttractorGroup);
752 myGeomSelWdg2 = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter3, 0, /*multiSel=*/false);
753 myGeomSelWdg2->SetDefaultText(tr("BLS_SEL_FACE"), "QLineEdit { color: grey }");
754 myGeomSelWdg2->AvoidSimultaneousSelection(myGeomSelWdg1);
755 myAttractorCheck = new QCheckBox(tr("BLSURF_ATTRACTOR"),myAttractorGroup);
756 myConstSizeCheck = new QCheckBox(tr("BLSURF_CONST_SIZE"),myAttractorGroup);
757 QFrame* attLine = new QFrame(myAttractorGroup);
758 attLine->setFrameShape(QFrame::HLine);
759 attLine->setFrameShadow(QFrame::Sunken);
760 myAttSelWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter2, myAttractorGroup, /*multiSel=*/false);
761 myAttSelWdg->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }");
762 myAttSizeSpin = new SMESHGUI_SpinBox(myAttractorGroup);
763 myAttSizeSpin->RangeStepAndValidator(0., COORD_MAX, 1.0, "length_precision");
764 myAttSizeLabel = new QLabel(tr("BLSURF_SM_SIZE"),myAttractorGroup);
765 myAttDistSpin = new SMESHGUI_SpinBox(myAttractorGroup);
766 myAttDistSpin->RangeStepAndValidator(0., COORD_MAX, 10.0, "length_precision");
767 myAttDistLabel = new QLabel(tr("BLSURF_ATT_DIST"),myAttractorGroup);
768 myAttDistSpin2 = new SMESHGUI_SpinBox(myAttractorGroup);
769 myAttDistSpin2->RangeStepAndValidator(0., COORD_MAX, 1.0, "length_precision");
770 myAttDistLabel2 = new QLabel(tr("BLSURF_ATT_RADIUS"),myAttractorGroup);
772 myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg1);
773 myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg2);
777 addMapButton = new QPushButton(tr("BLSURF_SM_ADD"),mySmpGroup);
778 removeMapButton = new QPushButton(tr("BLSURF_SM_REMOVE"),mySmpGroup);
779 modifyMapButton = new QPushButton(tr("BLSURF_SM_MODIFY"),mySmpGroup);
780 modifyMapButton->setEnabled(false);
783 myAttSelWdg->setEnabled(false);
784 myAttSizeSpin->setEnabled(false);
785 myAttSizeLabel->setEnabled(false);
786 myAttDistSpin->setEnabled(false);
787 myAttDistLabel->setEnabled(false);
788 myAttDistSpin2->setEnabled(false);
789 myAttDistLabel2->setEnabled(false);
790 myAttDistSpin->setValue(0.);
791 myAttDistSpin2->setValue(0.);
792 myAttSizeSpin->setValue(0.);
793 mySmpSizeSpin->setValue(0.);
796 // ADD WIDGETS (SIZEMAP TAB)
797 anSmpLayout->addWidget(mySizeMapTable, 0, 0, SMP_NB_LINES, 1);
798 anSmpLayout->setColumnStretch(0, 1);
799 // anSmpLayout->addWidget(line2, SMP_SEPARATOR2, 1, 2, 2);
800 anSmpLayout->addWidget(smpTab, SMP_TAB_WDG, 1, 1, 3);
801 anSmpLayout->setRowStretch(SMP_TAB_WDG, 1);
802 anSmpLayout->addWidget(addMapButton, SMP_ADD_BTN, 1, 1, 1);
803 anSmpLayout->addWidget(removeMapButton, SMP_ADD_BTN, 2, 1, 1);
804 anSmpLayout->addWidget(modifyMapButton, SMP_ADD_BTN, 3, 1, 1);
807 anSmpStdLayout->addWidget(myGeomSelWdg1, SMP_GEOM_BTN_1, 1, 1, 2);
808 anSmpStdLayout->addWidget(mySmpSizeLabel, SMP_SIZE, 1, 1, 1);
809 anSmpStdLayout->addWidget(mySmpSizeSpin, SMP_SIZE, 2, 1, 1);
810 anSmpStdLayout->setRowStretch(SMP_SPACE2, 1);
813 anAttLayout->addWidget(myGeomSelWdg2, SMP_GEOM_BTN_2, 1, 1, 2);
814 anAttLayout->addWidget(myAttractorCheck, ATT_CHECK, 1, 1, 2);
815 anAttLayout->addWidget(myConstSizeCheck, CONST_SIZE_CHECK,1, 1, 2);
816 anAttLayout->addWidget(attLine, SMP_SPACE, 1, 1, 2);
817 anAttLayout->addWidget(myAttSelWdg, SMP_ATT_SHAPE, 1, 1, 2);
818 anAttLayout->addWidget(myAttSizeLabel, SMP_ATT_SIZE, 1, 1, 1);
819 anAttLayout->addWidget(myAttSizeSpin, SMP_ATT_SIZE, 2, 1, 1);
820 anAttLayout->addWidget(myAttDistLabel, SMP_ATT_DIST, 1, 1, 1);
821 anAttLayout->addWidget(myAttDistSpin, SMP_ATT_DIST, 2, 1, 1);
822 anAttLayout->addWidget(myAttDistLabel2, SMP_ATT_RAD, 1, 1, 1);
823 anAttLayout->addWidget(myAttDistSpin2, SMP_ATT_RAD, 2, 1, 1);
824 anAttLayout->setRowStretch(SMP_ATT_RAD+1, 1);
826 smpTab->insertTab( SMP_STD_TAB, mySmpStdGroup, tr( "BLSURF_SM_STD_TAB" ) );
827 smpTab->insertTab( ATT_TAB, myAttractorGroup, tr( "BLSURF_SM_ATT_TAB" ) );
829 smpTab->setCurrentIndex( SMP_STD_TAB );
831 // Enforced vertices parameters
832 myEnfGroup = new QWidget( dlg() );
833 QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
835 myEnforcedTreeWidget = new QTreeWidget(myEnfGroup);
836 myEnforcedTreeWidget->setColumnCount( ENF_VER_NB_COLUMNS );
837 myEnforcedTreeWidget->setSortingEnabled(true);
838 QStringList enforcedHeaders;
839 enforcedHeaders << tr("BLSURF_ENF_VER_NAME_COLUMN") << tr("BLSURF_ENF_VER_FACE_ENTRY_COLUMN")
840 << tr("BLSURF_ENF_VER_X_COLUMN")<< tr("BLSURF_ENF_VER_Y_COLUMN") << tr("BLSURF_ENF_VER_Z_COLUMN")
841 << tr("BLSURF_ENF_VER_ENTRY_COLUMN") << tr( "BLSURF_ENF_VER_GROUP_COLUMN" );
843 myEnforcedTreeWidget->setHeaderLabels(enforcedHeaders);
844 myEnforcedTreeWidget->header()->setStretchLastSection(true);
845 myEnforcedTreeWidget->setAlternatingRowColors(true);
846 myEnforcedTreeWidget->setUniformRowHeights(true);
847 myEnforcedTreeWidget->setAnimated(true);
848 myEnforcedTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
849 myEnforcedTreeWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
850 for (int column = 0; column < ENF_VER_NB_COLUMNS; ++column) {
851 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
852 myEnforcedTreeWidget->header()->setResizeMode(column,QHeaderView::Interactive);
854 myEnforcedTreeWidget->header()->setSectionResizeMode(column,QHeaderView::Interactive);
856 myEnforcedTreeWidget->resizeColumnToContents(column);
858 myEnforcedTreeWidget->hideColumn(ENF_VER_FACE_ENTRY_COLUMN);
859 myEnforcedTreeWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
860 myEnforcedTreeWidget->setItemDelegate(new EnforcedTreeWidgetDelegate());
862 // FACE AND VERTEX SELECTION
863 TColStd_MapOfInteger shapeTypes1, shapeTypes2;
864 shapeTypes1.Add( TopAbs_FACE );
865 shapeTypes1.Add( TopAbs_COMPOUND );
866 shapeTypes2.Add( TopAbs_VERTEX );
867 shapeTypes2.Add( TopAbs_COMPOUND );
869 // SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1);
870 // myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true);
871 // myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }");
873 SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes2);
874 myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
875 myEnfVertexWdg->SetDefaultText(tr("BLS_SEL_VERTICES"), "QLineEdit { color: grey }");
877 //myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg);
879 QLabel* myXCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_X_LABEL" ), myEnfGroup );
880 myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
881 myXCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
883 QLabel* myYCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_Y_LABEL" ), myEnfGroup );
884 myYCoord = new SMESHGUI_SpinBox(myEnfGroup);
885 myYCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
887 QLabel* myZCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_Z_LABEL" ), myEnfGroup );
888 myZCoord = new SMESHGUI_SpinBox(myEnfGroup);
889 myZCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
891 QLabel* myGroupNameLabel = new QLabel( tr( "BLSURF_ENF_VER_GROUP_LABEL" ), myEnfGroup );
892 myGroupName = new QLineEdit(myEnfGroup);
894 addVertexButton = new QPushButton(tr("BLSURF_ENF_VER_VERTEX"),myEnfGroup);
895 removeVertexButton = new QPushButton(tr("BLSURF_ENF_VER_REMOVE"),myEnfGroup);
897 myInternalEnforcedVerticesAllFaces = new QCheckBox(tr("BLSURF_ENF_VER_INTERNAL_VERTICES"),myEnfGroup);
899 QLabel* myInternalEnforcedVerticesAllFacesGroupLabel = new QLabel( tr( "BLSURF_ENF_VER_GROUP_LABEL" ), myEnfGroup );
900 myInternalEnforcedVerticesAllFacesGroup = new QLineEdit(myEnfGroup);
902 anEnfLayout->addWidget(myEnforcedTreeWidget, 0, 0, ENF_VER_NB_LINES, 1);
903 QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
904 // FACE AND VERTEX SELECTION
905 //anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2);
906 anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
907 anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
908 anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
909 anEnfLayout2->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 0, 1, 1);
910 anEnfLayout2->addWidget(myYCoord, ENF_VER_Y_COORD, 1, 1, 1);
911 anEnfLayout2->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 0, 1, 1);
912 anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1);
913 anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1);
914 anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1);
915 anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
916 anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
917 anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFaces, ENF_VER_INTERNAL_ALL_FACES, 0, 1, 2);
918 anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroupLabel, ENF_VER_INTERNAL_ALL_FACES_GROUP, 0, 1, 1);
919 anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroup, ENF_VER_INTERNAL_ALL_FACES_GROUP, 1, 1, 1);
920 anEnfLayout2->setRowStretch(ENF_VER_NB_LINES+1, 1);
921 anEnfLayout->addLayout(anEnfLayout2, 0,1,ENF_VER_NB_LINES+1,2);
924 // Periodicity parameters
925 myPeriodicityGroup = new QWidget( dlg() );
926 aPeriodicityLayout1 = new QGridLayout(myPeriodicityGroup);
928 myPeriodicitySplitter = new QSplitter(myPeriodicityGroup);
929 myPeriodicitySplitter->setOrientation(Qt::Horizontal);
930 aPeriodicityLayout1->addWidget(myPeriodicitySplitter, 0, 0, 1, 1);
932 myPeriodicityTreeWidget = new QTreeWidget(myPeriodicitySplitter);
934 QStringList myPeriodicityTreeHeaders;
935 myPeriodicityTreeHeaders << tr("BLSURF_PERIODICITY_OBJ_SOURCE_COLUMN")
936 << tr("BLSURF_PERIODICITY_OBJ_TARGET_COLUMN")
937 << tr("BLSURF_PERIODICITY_P1_SOURCE_COLUMN")
938 << tr("BLSURF_PERIODICITY_P2_SOURCE_COLUMN")
939 << tr("BLSURF_PERIODICITY_P3_SOURCE_COLUMN")
940 << tr("BLSURF_PERIODICITY_P1_TARGET_COLUMN")
941 << tr("BLSURF_PERIODICITY_P2_TARGET_COLUMN")
942 << tr("BLSURF_PERIODICITY_P3_TARGET_COLUMN")
943 << tr("BLSURF_PERIODICITY_SHAPE_TYPE");
944 myPeriodicityTreeWidget->setHeaderLabels(myPeriodicityTreeHeaders);
946 // Hide the vertex name to make the widget more readable
947 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P1_SOURCE_COLUMN);
948 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P2_SOURCE_COLUMN);
949 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P3_SOURCE_COLUMN);
950 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P1_TARGET_COLUMN);
951 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P2_TARGET_COLUMN);
952 myPeriodicityTreeWidget->hideColumn(PERIODICITY_P3_TARGET_COLUMN);
953 myPeriodicityTreeWidget->hideColumn(PERIODICITY_SHAPE_TYPE);
956 myPeriodicityTreeWidget->setColumnCount(PERIODICITY_NB_COLUMN);
957 myPeriodicityTreeWidget->setSortingEnabled(true);
959 myPeriodicityTreeWidget->setAlternatingRowColors(true);
960 myPeriodicityTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
961 myPeriodicityTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
963 size_t periodicityVisibleColumns = 2;
964 for (size_t column = 0; column < periodicityVisibleColumns; ++column) {
965 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
966 myPeriodicityTreeWidget->header()->setResizeMode(column,QHeaderView::Interactive);
968 myPeriodicityTreeWidget->header()->setSectionResizeMode(column,QHeaderView::Interactive);
970 myPeriodicityTreeWidget->resizeColumnToContents(column);
972 myPeriodicityTreeWidget->header()->setStretchLastSection(true);
974 myPeriodicitySplitter->addWidget(myPeriodicityTreeWidget);
976 myPeriodicityRightWidget = new QWidget(myPeriodicitySplitter);
978 myPeriodicityRightGridLayout = new QGridLayout(myPeriodicityRightWidget);
979 myPeriodicityGroupBox1 = new QGroupBox(tr("BLSURF_PRECAD_PERIODICITY"), myPeriodicityRightWidget);
980 myPeriodicityGroupBox1Layout = new QGridLayout(myPeriodicityGroupBox1);
982 myPeriodicityRightGridLayout->addWidget(myPeriodicityGroupBox1, 0, 0, 1, 2);
984 myPeriodicityOnFaceRadioButton = new QRadioButton(tr("BLSURF_PERIODICITY_ON_FACE"), myPeriodicityGroupBox1);
985 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityOnFaceRadioButton, 0, 0, 1, 2);
987 myPeriodicityOnFaceRadioButton->setChecked(true);
989 myPeriodicityOnEdgeRadioButton = new QRadioButton(tr("BLSURF_PERIODICITY_ON_EDGE"), myPeriodicityGroupBox1);
990 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityOnEdgeRadioButton, 0, 2, 1, 2);
993 // FACE, EDGE AND VERTEX SELECTION
994 TColStd_MapOfInteger shapeTypesFace, shapeTypesEdge;
995 shapeTypesFace.Add( TopAbs_FACE );
996 shapeTypesFace.Add( TopAbs_EDGE );
997 shapeTypesFace.Add( TopAbs_COMPOUND );
998 shapeTypesEdge.Add( TopAbs_EDGE );
999 shapeTypesEdge.Add( TopAbs_COMPOUND );
1001 // myPeriodicityEdgeFilter = new SMESH_NumberFilter("GEOM", TopAbs_EDGE, 0, shapeTypesEdge);
1003 myPeriodicityMainSourceLabel = new QLabel(tr("BLSURF_PERIODICITY_MAIN_SOURCE"), myPeriodicityGroupBox1);
1004 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityMainSourceLabel, 1, 0, 1, 1);
1006 SMESH_NumberFilter* myPeriodicitySourceFaceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, shapeTypesFace);
1007 myPeriodicitySourceFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicitySourceFaceFilter, 0, /*multiSel=*/false);
1008 // myPeriodicitySourceFaceWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_FACE"), "QLineEdit { color: grey }");
1009 myPeriodicityGroupBox1Layout->addWidget(myPeriodicitySourceFaceWdg, 1, 1, 1, 1);
1011 // myPeriodicitySourceEdgeWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityEdgeFilter, 0, /*multiSel=*/false);
1012 // myPeriodicitySourceEdgeWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_EDGE"), "QLineEdit { color: grey }");
1013 // myPeriodicitySourceEdgeWdg->hide();
1014 // myPeriodicityGroupBox1Layout->addWidget(myPeriodicitySourceEdgeWdg, 1, 1, 1, 1);
1016 myPeriodicityMainTargetLabel = new QLabel(tr("BLSURF_PERIODICITY_MAIN_TARGET"), myPeriodicityGroupBox1);
1017 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityMainTargetLabel, 1, 2, 1, 1);
1019 SMESH_NumberFilter* myPeriodicityTargetFaceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, shapeTypesFace);
1020 myPeriodicityTargetFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityTargetFaceFilter, 0, /*multiSel=*/false);
1021 // myPeriodicityTargetFaceWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_FACE"), "QLineEdit { color: grey }");
1022 myPeriodicityGroupBox1Layout->addWidget(myPeriodicityTargetFaceWdg, 1, 3, 1, 1);
1024 // myPeriodicityTargetEdgeWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityEdgeFilter, 0, /*multiSel=*/false);
1025 // myPeriodicityTargetEdgeWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_EDGE"), "QLineEdit { color: grey }");
1026 // myPeriodicityTargetEdgeWdg->hide();
1027 // myPeriodicityGroupBox1Layout->addWidget(myPeriodicityTargetEdgeWdg, 1, 3, 1, 1);
1029 myPeriodicityGroupBox2 = new QGroupBox(tr("BLSURF_PERIODICITY_WITH_VERTICES"), myPeriodicityRightWidget);
1030 myPeriodicityGroupBox2Layout = new QGridLayout(myPeriodicityGroupBox2);
1031 myPeriodicityRightGridLayout->addWidget(myPeriodicityGroupBox2, 1, 0, 1, 2);
1033 myPeriodicityGroupBox2->setCheckable(true);
1034 myPeriodicityGroupBox2->setChecked(false);
1036 myPeriodicitySourceLabel = new QLabel(tr("BLSURF_PERIODICITY_SOURCE"), myPeriodicityGroupBox2);
1037 myPeriodicityGroupBox2Layout->addWidget(myPeriodicitySourceLabel, 0, 0, 1, 2);
1039 myPeriodicityTargetLabel = new QLabel(tr("BLSURF_PERIODICITY_TARGET"), myPeriodicityGroupBox2);
1040 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityTargetLabel, 0, 2, 1, 2);
1043 myPeriodicityP1SourceLabel = new QLabel(tr("BLSURF_PERIODICITY_P1_SOURCE"), myPeriodicityGroupBox2);
1044 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1SourceLabel, 1, 0, 1, 1);
1047 SMESH_NumberFilter* myPeriodicityP1SourceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1048 myPeriodicityP1SourceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP1SourceFilter, 0, /*multiSel=*/false);
1049 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1SourceWdg, 1, 1, 1, 1);
1052 myPeriodicityP2SourceLabel = new QLabel(tr("BLSURF_PERIODICITY_P2_SOURCE"), myPeriodicityGroupBox2);
1053 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2SourceLabel, 2, 0, 1, 1);
1055 SMESH_NumberFilter* myPeriodicityP2SourceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1056 myPeriodicityP2SourceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP2SourceFilter, 0, /*multiSel=*/false);
1057 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2SourceWdg, 2, 1, 1, 1);
1060 myPeriodicityP3SourceLabel = new QLabel(tr("BLSURF_PERIODICITY_P3_SOURCE"), myPeriodicityGroupBox2);
1061 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3SourceLabel, 3, 0, 1, 1);
1063 SMESH_NumberFilter* myPeriodicityP3SourceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1064 myPeriodicityP3SourceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP3SourceFilter, 0, /*multiSel=*/false);
1065 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3SourceWdg, 3, 1, 1, 1);
1068 myPeriodicityP1TargetLabel = new QLabel(tr("BLSURF_PERIODICITY_P1_TARGET"), myPeriodicityGroupBox2);
1069 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1TargetLabel, 1, 2, 1, 1);
1071 SMESH_NumberFilter* myPeriodicityP1TargetFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1072 myPeriodicityP1TargetWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP1TargetFilter, 0, /*multiSel=*/false);
1073 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1TargetWdg, 1, 3, 1, 1);
1076 myPeriodicityP2TargetLabel = new QLabel(tr("BLSURF_PERIODICITY_P2_TARGET"), myPeriodicityGroupBox2);
1077 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2TargetLabel, 2, 2, 1, 1);
1079 SMESH_NumberFilter* myPeriodicityP2TargetFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1080 myPeriodicityP2TargetWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP2TargetFilter, 0, /*multiSel=*/false);
1081 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2TargetWdg, 2, 3, 1, 1);
1084 myPeriodicityP3TargetLabel = new QLabel(tr("BLSURF_PERIODICITY_P3_TARGET"), myPeriodicityGroupBox2);
1085 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3TargetLabel, 3, 2, 1, 1);
1087 SMESH_NumberFilter* myPeriodicityP3TargetFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
1088 myPeriodicityP3TargetWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP3TargetFilter, 0, /*multiSel=*/false);
1089 myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3TargetWdg, 3, 3, 1, 1);
1091 myPeriodicityVerticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
1092 myPeriodicityGroupBox2Layout->addItem(myPeriodicityVerticalSpacer, 7, 1, 1, 1);
1095 myPeriodicityAddButton = new QPushButton(tr("BLSURF_PERIODICITY_ADD"),myPeriodicityRightWidget);
1096 myPeriodicityRightGridLayout->addWidget(myPeriodicityAddButton, 2, 0, 1, 1);
1098 myPeriodicityRemoveButton = new QPushButton(tr("BLSURF_PERIODICITY_REMOVE"),myPeriodicityRightWidget);
1099 myPeriodicityRightGridLayout->addWidget(myPeriodicityRemoveButton, 2, 1, 1, 1);
1101 myPeriodicitySplitter->addWidget(myPeriodicityRightWidget);
1103 myPeriodicitySelectionWidgets.clear();
1104 myPeriodicitySelectionWidgets.append(myPeriodicitySourceFaceWdg);
1105 myPeriodicitySelectionWidgets.append(myPeriodicityTargetFaceWdg);
1106 myPeriodicitySelectionWidgets.append(myPeriodicityP1SourceWdg);
1107 myPeriodicitySelectionWidgets.append(myPeriodicityP2SourceWdg);
1108 myPeriodicitySelectionWidgets.append(myPeriodicityP3SourceWdg);
1109 myPeriodicitySelectionWidgets.append(myPeriodicityP1TargetWdg);
1110 myPeriodicitySelectionWidgets.append(myPeriodicityP2TargetWdg);
1111 myPeriodicitySelectionWidgets.append(myPeriodicityP3TargetWdg);
1112 avoidSimultaneousSelection(myPeriodicitySelectionWidgets);
1114 // HyperPatch parameters
1116 QWidget* hpGroup = new QWidget();
1117 QGridLayout* hpLayout = new QGridLayout(hpGroup);
1119 myHyPatchTable = new QTableWidget( hpGroup );
1120 myHyPatchTable->setColumnCount(1);
1121 myHyPatchTable->setHorizontalHeaderLabels( QStringList() << tr("BLSURF_HYPATCH_TBL_HEADER") );
1122 myHyPatchTable->setAlternatingRowColors(true);
1123 myHyPatchTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
1126 QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
1127 myHyPatchFaceSelBtn = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_FACE"), hpGroup );
1128 myHyPatchGroupSelBtn = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_GROUP"), hpGroup );
1129 myHyPatchFaceSelBtn->setCheckable( true );
1130 myHyPatchGroupSelBtn->setCheckable( true );
1132 myHyPatchFaceSelector = new StdMeshersGUI_SubShapeSelectorWdg( hpGroup, TopAbs_FACE, /*toShowList=*/false );
1134 QLabel* hpTagsLbl = new QLabel( tr("BLSURF_TAGS"), hpGroup );
1135 myHyPatchTagsLE = new QLineEdit( hpGroup );
1136 myHyPatchTagsLE->setValidator( new SMESHGUI_IdValidator( hpGroup ));
1138 QPushButton* hpAddBtn = new QPushButton( tr("BLSURF_SM_ADD"), hpGroup );
1139 QPushButton* hpRemBtn = new QPushButton( tr("BLSURF_SM_REMOVE"), hpGroup );
1141 hpLayout->addWidget( myHyPatchTable, 0, 0, 5, 1 );
1142 hpLayout->addWidget( myHyPatchFaceSelBtn, 0, 1, 1, 2 );
1143 hpLayout->addWidget( myHyPatchGroupSelBtn, 0, 3, 1, 2 );
1144 hpLayout->addWidget( hpTagsLbl, 1, 1, 1, 1 );
1145 hpLayout->addWidget( myHyPatchTagsLE, 1, 2, 1, 3 );
1146 hpLayout->addWidget( hpAddBtn, 2, 1, 1, 2 );
1147 hpLayout->addWidget( hpRemBtn, 2, 3, 1, 2 );
1148 hpLayout->addWidget( myHyPatchFaceSelector, 3, 1, 1, 4 );
1153 myTabWidget->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
1154 myTabWidget->insertTab( ADV_TAB, myAdvGroup, tr( "BLSURF_ADV_ARGS" ) );
1156 myTabWidget->insertTab( SMP_TAB, mySmpGroup, tr( "LOCAL_SIZE" ) );
1157 myTabWidget->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) );
1158 myTabWidget->insertTab( PERIODICITY_TAB, myPeriodicityGroup, tr( "BLSURF_PERIODICITY" ) );
1159 myTabWidget->insertTab( HYPERPATCH_TAB, hpGroup, tr( "BLSURF_HYPERPATCH_TAB" ));
1165 myPeriodicityGroup->hide();
1168 myTabWidget->setCurrentIndex( STD_TAB );
1170 connect( myAdvWidget->addBtn, SIGNAL( clicked() ), this, SLOT( onAddOption() ) );
1173 connect( addMapButton, SIGNAL( clicked()), this, SLOT( onAddMap() ) );
1174 connect( removeMapButton, SIGNAL( clicked()), this, SLOT( onRemoveMap() ) );
1175 connect( modifyMapButton, SIGNAL( clicked()), this, SLOT( onModifyMap() ) );
1176 connect( mySizeMapTable, SIGNAL( itemClicked (QTreeWidgetItem *, int)),this, SLOT( onSmpItemClicked(QTreeWidgetItem *, int) ) );
1177 connect( myGeomSelWdg2, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
1178 connect( myGeomSelWdg1, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
1179 connect( myAttSelWdg, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
1180 connect( mySizeMapTable, SIGNAL( itemChanged (QTreeWidgetItem *, int)),this, SLOT( onSetSizeMap(QTreeWidgetItem *, int) ) );
1181 connect( myAttractorCheck, SIGNAL( stateChanged ( int )), this, SLOT( onAttractorClicked( int ) ) );
1182 connect( myConstSizeCheck, SIGNAL( stateChanged ( int )), this, SLOT( onConstSizeClicked( int ) ) );
1183 connect( smpTab, SIGNAL( currentChanged ( int )), this, SLOT( onTabChanged( int ) ) );
1184 connect( myTabWidget, SIGNAL( currentChanged ( int )), this, SLOT( onTabChanged( int ) ) );
1186 // Enforced vertices
1187 connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this, SLOT( synchronizeCoords() ) );
1188 connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( updateEnforcedVertexValues(QTreeWidgetItem *, int) ) );
1189 connect( myEnforcedTreeWidget,SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
1190 connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertices() ) );
1191 connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
1192 connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
1193 connect( myInternalEnforcedVerticesAllFaces, SIGNAL( stateChanged ( int )), this, SLOT( onInternalVerticesClicked( int ) ) );
1196 connect( myPeriodicityAddButton, SIGNAL( clicked()), this, SLOT( onAddPeriodicity() ) );
1197 connect( myPeriodicityRemoveButton, SIGNAL( clicked()), this, SLOT( onRemovePeriodicity() ) );
1198 connect( myPeriodicityTreeWidget, SIGNAL( itemClicked(QTreeWidgetItem*, int)), this, SLOT( onPeriodicityTreeClicked(QTreeWidgetItem *, int) ) );
1199 connect( myPeriodicityGroupBox2, SIGNAL(toggled(bool)), this, SLOT(onPeriodicityByVerticesChecked(bool)));
1201 ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
1202 for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++)
1204 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1205 connect( w1, SIGNAL(contentModified ()), this, SLOT(onPeriodicityContentModified()));
1210 connect( myHyPatchFaceSelBtn, SIGNAL( toggled(bool) ), SLOT( onHyPatchFaceSelection(bool) ));
1211 connect( myHyPatchGroupSelBtn, SIGNAL( toggled(bool) ), SLOT( onHyPatchGroupSelection(bool) ));
1212 connect( myHyPatchFaceSelector, SIGNAL( shapeSelected() ), SLOT( onHyPatchSelectionChanged()));
1213 connect( hpAddBtn, SIGNAL( clicked() ), SLOT( onHyPatchAdd()));
1214 connect( hpRemBtn, SIGNAL( clicked() ), SLOT( onHyPatchRemove()));
1219 /** BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget*, QWidget*)
1220 This method stop the selection of the widgets StdMeshersGUI_ObjectReferenceParamWdg
1222 // void BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget* old, QWidget* now)
1224 // if ((now == myXCoord) || (now == myYCoord) || (now == myZCoord)
1225 // || (now = myGroupName) || (now = myGlobalGroupName) || (now = myEnforcedTreeWidget)) {
1226 // BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1227 // that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1228 // myEnfFaceWdg->deactivateSelection();
1229 // myEnfVertexWdg->deactivateSelection();
1233 void BLSURFPluginGUI_HypothesisCreator::onStateChange()
1235 myStdWidget->onPhysicalMeshChanged();
1239 * This method resets the content of the X, Y, Z widgets;
1241 void BLSURFPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
1243 myXCoord->setCleared(true);
1244 myYCoord->setCleared(true);
1245 myZCoord->setCleared(true);
1246 myXCoord->setText("");
1247 myYCoord->setText("");
1248 myZCoord->setText("");
1249 // myGroupName->setText("");
1252 /** BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item, column)
1253 This method updates the tooltip of a modified item. The QLineEdit widgets content
1254 is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
1256 void BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTreeWidgetItem* item, int column) {
1257 QVariant vertexName = item->data(ENF_VER_NAME_COLUMN, Qt::EditRole);
1258 QVariant x = item->data(ENF_VER_X_COLUMN, Qt::EditRole);
1259 QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole);
1260 QVariant z = item->data(ENF_VER_Z_COLUMN, Qt::EditRole);
1261 QVariant entry = item->data(ENF_VER_ENTRY_COLUMN, Qt::EditRole);
1262 QString groupName = item->data(ENF_VER_GROUP_COLUMN, Qt::EditRole).toString();
1263 QTreeWidgetItem* parent = item->parent();
1265 clearEnforcedVertexWidgets();
1267 if (parent && (!x.isNull() || !entry.isNull())) {
1268 QString shapeName = parent->data(ENF_VER_NAME_COLUMN, Qt::EditRole).toString();
1269 QString toolTip = shapeName + QString(": ") + vertexName.toString();
1270 if (entry.isNull()) {
1271 toolTip += QString("(") + x.toString();
1272 toolTip += QString(", ") + y.toString();
1273 toolTip += QString(", ") + z.toString();
1274 toolTip += QString(")");
1277 if (!groupName.isEmpty())
1278 toolTip += QString(" [") + groupName + QString("]");
1280 item->setToolTip(ENF_VER_NAME_COLUMN,toolTip);
1283 myXCoord->SetValue(x.toDouble());
1284 myYCoord->SetValue(y.toDouble());
1285 myZCoord->SetValue(z.toDouble());
1288 if (!groupName.isEmpty())
1289 myGroupName->setText(groupName);
1293 void BLSURFPluginGUI_HypothesisCreator::onSelectEnforcedVertex() {
1294 int nbSelEnfVertex = myEnfVertexWdg->NbObjects();
1295 clearEnforcedVertexWidgets();
1296 if (nbSelEnfVertex == 1)
1298 if ( CORBA::is_nil( getGeomEngine() ) && !GeometryGUI::InitGeomGen() )
1301 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
1302 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
1303 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1304 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
1305 if (CORBA::is_nil(measureOp))
1308 CORBA::Double x,y,z;
1309 measureOp->PointCoordinates (myEnfVertex, x, y, z);
1310 if ( measureOp->IsDone() )
1312 myXCoord->SetValue(x);
1313 myYCoord->SetValue(y);
1314 myZCoord->SetValue(z);
1320 /** BLSURFPluginGUI_HypothesisCreator::synchronizeCoords()
1321 This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
1322 of the enforced vertex clicked in the tree widget.
1324 void BLSURFPluginGUI_HypothesisCreator::synchronizeCoords() {
1325 clearEnforcedVertexWidgets();
1326 QList<QTreeWidgetItem *> items = myEnforcedTreeWidget->selectedItems();
1327 if (! items.isEmpty() && items.size() == 1) {
1328 QTreeWidgetItem *item = items[0];
1329 // for (int i=0 ; i < items.size() ; i++) {
1331 QVariant x = item->data(ENF_VER_X_COLUMN, Qt::EditRole);
1332 QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole);
1333 QVariant z = item->data(ENF_VER_Z_COLUMN, Qt::EditRole);
1334 QVariant entry = item->data(ENF_VER_ENTRY_COLUMN, Qt::EditRole);
1335 QVariant group = item->data(ENF_VER_GROUP_COLUMN, Qt::EditRole);
1336 if (!x.isNull()/* && entry.isNull()*/) {
1337 myXCoord->SetValue(x.toDouble());
1338 myYCoord->SetValue(y.toDouble());
1339 myZCoord->SetValue(z.toDouble());
1342 if (!group.isNull() && (!x.isNull() || !entry.isNull()))
1343 myGroupName->setText(group.toString());
1348 /** BLSURFPluginGUI_HypothesisCreator::addEnforcedFace(entry, shapeName, useInternalVertices)
1349 This method adds a face containing enforced vertices in the tree widget.
1351 QTreeWidgetItem* BLSURFPluginGUI_HypothesisCreator::addEnforcedFace(std::string theFaceEntry, std::string theFaceName) {
1352 // Find theFaceEntry item
1353 QList<QTreeWidgetItem* > theItemList = myEnforcedTreeWidget->findItems(QString(theFaceEntry.c_str()),Qt::MatchExactly,ENF_VER_FACE_ENTRY_COLUMN);
1354 QTreeWidgetItem* theItem;
1355 if (theItemList.empty()) {
1356 theItem = new QTreeWidgetItem();
1357 theItem->setData(ENF_VER_FACE_ENTRY_COLUMN, Qt::EditRole, QVariant(theFaceEntry.c_str()));
1358 theItem->setData(ENF_VER_NAME_COLUMN, Qt::EditRole, QVariant(theFaceName.c_str()));
1359 theItem->setToolTip(ENF_VER_NAME_COLUMN,QString(theFaceEntry.c_str()));
1360 myEnforcedTreeWidget->addTopLevelItem(theItem);
1363 theItem = theItemList[0];
1368 /** BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(entry, shapeName, x, y, z)
1369 This method adds an enforced vertex (x,y,z) to shapeName in the tree widget.
1371 void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z,
1372 std::string vertexName,
1373 std::string geomEntry,
1374 std::string groupName)
1376 bool okToCreate = true;
1378 const int nbVert = myEnforcedTreeWidget->topLevelItemCount();
1379 for (int row = 0; row < nbVert; row++ )
1381 QTreeWidgetItem* child = myEnforcedTreeWidget->topLevelItem( row );
1382 QString childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString();
1383 QString childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString();
1384 double childX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
1385 double childY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
1386 double childZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
1387 if (((childEntry.isEmpty()) && (childX == x) && (childY == y) && (childZ == z)) ||
1388 ( !childEntry.isEmpty() && childEntry == geomEntry.c_str() ))
1390 // update group name
1391 if ( childGroupName != groupName.c_str() ) {
1392 child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
1402 QTreeWidgetItem *vertexItem = new QTreeWidgetItem( myEnforcedTreeWidget );
1403 vertexItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
1404 QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
1405 QSize iconSize = iconSelect.size()*0.7;
1407 int vertexIndex=nbVert;
1408 QString myVertexName;
1410 while(indexRef != vertexIndex) {
1411 indexRef = vertexIndex;
1412 if (vertexName.empty())
1413 myVertexName = QString("Vertex #%1").arg(vertexIndex);
1415 myVertexName = QString(vertexName.c_str());
1417 for (int row = 0;row<nbVert;row++) {
1418 QString name = myEnforcedTreeWidget->topLevelItem(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString();
1419 if (myVertexName == name) {
1425 vertexItem->setData( ENF_VER_NAME_COLUMN, Qt::EditRole, myVertexName );
1426 if (geomEntry.empty()) {
1427 vertexItem->setData( ENF_VER_X_COLUMN, Qt::EditRole, QVariant(x) );
1428 vertexItem->setData( ENF_VER_Y_COLUMN, Qt::EditRole, QVariant(y) );
1429 vertexItem->setData( ENF_VER_Z_COLUMN, Qt::EditRole, QVariant(z) );
1432 vertexItem->setIcon(ENF_VER_NAME_COLUMN, QIcon(iconSelect.scaled(iconSize,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
1433 vertexItem->setData( ENF_VER_ENTRY_COLUMN, Qt::EditRole, QString(geomEntry.c_str()) );
1435 if (groupName != "")
1436 vertexItem->setData( ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
1438 QString toolTip = myVertexName;
1439 if (geomEntry.empty()) {
1440 toolTip += QString(" (%1, %2, %3").arg(x).arg(y).arg(z);
1442 if (groupName != "")
1443 toolTip += QString(" [%1]").arg(groupName.c_str());
1445 vertexItem->setToolTip(ENF_VER_NAME_COLUMN,toolTip);
1446 myEnforcedTreeWidget->setCurrentItem(vertexItem,ENF_VER_NAME_COLUMN);
1449 /** BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
1450 This method is called when a item is added into the enforced vertices tree widget
1452 void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
1454 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1456 getGeomSelectionTool()->selectionMgr()->clearFilters();
1457 myEnfVertexWdg->deactivateSelection();
1459 for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
1460 myEnforcedTreeWidget->resizeColumnToContents(column);
1463 int selEnfVertex = myEnfVertexWdg->NbObjects();
1464 bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
1466 if ((selEnfVertex == 0) && coordsEmpty)
1469 string entry, shapeName;
1471 std::string groupName = myGroupName->text().simplified().toStdString();
1473 if (selEnfVertex <= 1)
1476 x = myXCoord->GetValue();
1477 y = myYCoord->GetValue();
1478 z = myZCoord->GetValue();
1479 if (selEnfVertex == 1) {
1480 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
1481 addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
1484 addEnforcedVertex(x, y, z, "", "", groupName);
1488 if ( CORBA::is_nil(getGeomEngine()))
1491 GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
1492 if (CORBA::is_nil(measureOp))
1495 CORBA::Double x,y,z;
1497 for (int j = 0 ; j < selEnfVertex ; j++)
1499 myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(j);
1500 if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
1501 measureOp->PointCoordinates (myEnfVertex, x, y, z);
1502 if ( measureOp->IsDone() )
1503 addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
1504 } else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
1505 addEnforcedVertex(0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
1511 myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
1513 for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
1514 myEnforcedTreeWidget->resizeColumnToContents(column);
1516 if ( myStdWidget->myPhysicalMesh->currentIndex() != PhysicalLocalSize ) {
1517 myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize );
1518 myStdWidget->onPhysicalMeshChanged();
1522 /** BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
1523 This method is called when a item is removed from the enforced vertices tree widget
1525 void BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() {
1526 QList<QTreeWidgetItem *> selectedItems = myEnforcedTreeWidget->selectedItems();
1527 QList<QTreeWidgetItem *> selectedVertices;
1528 QSet<QTreeWidgetItem *> selectedEntries;
1529 QTreeWidgetItem* item;
1531 foreach( item, selectedItems ) {
1532 QVariant value = item->data(ENF_VER_X_COLUMN, Qt::EditRole);
1533 if (! value.isNull())
1534 selectedVertices.append(item);
1536 value = item->data(ENF_VER_ENTRY_COLUMN, Qt::EditRole);
1537 if (! value.isNull())
1538 selectedVertices.append(item);
1540 selectedEntries.insert(item);
1544 foreach(item,selectedVertices) {
1545 QTreeWidgetItem* parent = item->parent();
1547 parent->removeChild(item);
1549 if ( parent && parent->childCount() == 0) {
1550 if (selectedEntries.contains(parent))
1551 selectedEntries.remove(parent);
1556 foreach(item,selectedEntries) {
1560 myEnforcedTreeWidget->selectionModel()->clearSelection();
1564 void BLSURFPluginGUI_HypothesisCreator::onInternalVerticesClicked(int state)
1566 myInternalEnforcedVerticesAllFacesGroup->setEnabled(state == Qt::Checked);
1569 /** BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity()
1570 This method is called when a item is added into the periodicity table widget
1572 void BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity() {
1574 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1576 that->getGeomSelectionTool()->selectionMgr()->clearFilters();
1577 ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
1578 for ( ; anIt != myPeriodicitySelectionWidgets.end(); anIt++)
1580 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1581 w1->deactivateSelection();
1585 // Source-Target selection
1586 int selSource = myPeriodicitySourceFaceWdg->NbObjects();
1587 int selTarget = myPeriodicityTargetFaceWdg->NbObjects();
1589 if (selSource == 0 || selTarget == 0)
1592 // Vertices selection
1593 if (myPeriodicityGroupBox2->isChecked())
1595 int P1Ssel = myPeriodicityP1SourceWdg->NbObjects();
1596 int P2Ssel = myPeriodicityP2SourceWdg->NbObjects();
1597 int P3Ssel = myPeriodicityP3SourceWdg->NbObjects();
1598 int P1Tsel = myPeriodicityP1TargetWdg->NbObjects();
1599 //int P2Tsel = myPeriodicityP2TargetWdg->NbObjects();
1600 int P3Tsel = myPeriodicityP3TargetWdg->NbObjects();
1602 if (P1Ssel!=1 || P2Ssel!=1 || P3Ssel!=1 || P1Tsel!=1 || P3Tsel!=1 || P3Tsel!=1)
1604 QString msg = tr("BLSURF_PERIODICITY_WRONG_NUMBER_OF_VERTICES");
1605 SUIT_MessageBox::critical( dlg(),"Error" , msg );
1610 // Add Source-Target in table
1611 string shapeEntry, sourceEntry, targetEntry;
1612 string shapeName, sourceName, targetName;
1613 GEOM::GEOM_Object_var shape;
1615 QTreeWidgetItem* item = new QTreeWidgetItem();
1616 myPeriodicityTreeWidget->addTopLevelItem(item);
1618 item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
1622 for (anIt = myPeriodicitySelectionWidgets.begin(); anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
1624 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1625 shape = w1->GetObject< GEOM::GEOM_Object >(0);
1626 shapeName = shape->GetName();
1627 shapeEntry = shape->GetStudyEntry();
1628 item->setData(k, Qt::EditRole, shapeName.c_str() );
1629 item->setData(k, Qt::UserRole, shapeEntry.c_str() );
1630 if (! myPeriodicityGroupBox2->isChecked() && k==1)
1634 // Add shape type in tree
1635 string onFace = (myPeriodicityOnFaceRadioButton->isChecked()) ? "1" : "0";
1636 item->setData(PERIODICITY_SHAPE_TYPE, Qt::UserRole, onFace.c_str());
1638 // Blank input fields
1639 for (anIt = myPeriodicitySelectionWidgets.begin(); anIt != myPeriodicitySelectionWidgets.end(); anIt++)
1641 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1642 w1->SetObject(GEOM::GEOM_Object::_nil());
1645 // for (int column = 0; column < myPeriodicityTreeWidget->columnCount(); ++column)
1646 // myPeriodicityTreeWidget->resizeColumnToContents(column);
1650 /** BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity()
1651 This method is called when a item is removed from the periodicity tree widget
1653 void BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity() {
1654 QList<QTreeWidgetItem *> selectedItems = myPeriodicityTreeWidget->selectedItems();
1655 QTreeWidgetItem* item;
1657 foreach(item,selectedItems) {
1661 myEnforcedTreeWidget->selectionModel()->clearSelection();
1664 /** BLSURFPluginGUI_HypothesisCreator::onPeriodicityByVerticesChecked()
1665 This method enable clears the field for periodicity by vertices
1667 void BLSURFPluginGUI_HypothesisCreator::onPeriodicityByVerticesChecked(bool checked)
1671 for (int k=2; k<myPeriodicitySelectionWidgets.size(); k++)
1673 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( myPeriodicitySelectionWidgets[k] );
1674 w1->deactivateSelection();
1675 w1->SetObject(CORBA::Object::_nil());
1680 /** BLSURFPluginGUI_HypothesisCreator::onPeriodicityRadioButtonChanged()
1681 This method enable the proper shape selection widget to Face or Edge shapes
1683 //void BLSURFPluginGUI_HypothesisCreator::onPeriodicityRadioButtonChanged()
1685 // if (myPeriodicityOnFaceRadioButton->isChecked())
1687 // myPeriodicitySourceEdgeWdg->hide();
1688 // myPeriodicityTargetEdgeWdg->hide();
1689 // myPeriodicitySourceFaceWdg->show();
1690 // myPeriodicityTargetFaceWdg->show();
1694 // myPeriodicitySourceFaceWdg->hide();
1695 // myPeriodicityTargetFaceWdg->hide();
1696 // myPeriodicitySourceEdgeWdg->show();
1697 // myPeriodicityTargetEdgeWdg->show();
1701 void BLSURFPluginGUI_HypothesisCreator::onPeriodicityTreeClicked(QTreeWidgetItem* item, int row)
1703 QString shapeName, shapeEntry;
1704 CORBA::Object_var shape;
1706 ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
1707 for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
1709 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1711 shapeName = item->data(k, Qt::EditRole).toString();
1712 shapeEntry = item->data(k, Qt::UserRole).toString();
1713 if (! shapeEntry.isEmpty())
1715 shape = entryToObject(shapeEntry);
1716 w1->SetObject(shape);
1717 w1->deactivateSelection();
1719 myPeriodicityGroupBox2->setChecked(1);
1722 myPeriodicityGroupBox2->setChecked(0);
1725 if (item->data(PERIODICITY_SHAPE_TYPE, Qt::UserRole) == "1")
1726 myPeriodicityOnFaceRadioButton->setChecked(true);
1728 myPeriodicityOnEdgeRadioButton->setChecked(true);
1733 /** BLSURFPluginGUI_HypothesisCreator::onPeriodicityContentModified()
1734 This method gives the focus to the next selection widget when a content is modified in a selection widget.
1736 void BLSURFPluginGUI_HypothesisCreator::onPeriodicityContentModified()
1738 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1740 ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
1742 // find wich selection widget is activated
1743 for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
1745 StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
1746 if (w1->IsSelectionActivated() && k<(myPeriodicitySelectionWidgets.size()-1))
1748 // don't activate vertex selection if the group box is not checked
1749 if (k==1 && !myPeriodicityGroupBox2->isChecked())
1751 // clear the selection, to avoid to put the same object in the other widget
1752 that->getGeomSelectionTool()->selectionMgr()->clearSelected();
1753 // activate the next widget
1754 StdMeshersGUI_ObjectReferenceParamWdg * w2 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( myPeriodicitySelectionWidgets[k+1] );
1755 w2->activateSelection();
1762 /** BLSURFPluginGUI_HypothesisCreator::retrieveParams()
1763 This method updates the GUI widgets with the hypothesis data
1765 void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
1767 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1769 BlsurfHypothesisData data;
1770 that->readParamsFromHypo( data );
1773 myName->setText( data.myName );
1774 QFontMetrics metrics( myName->font() );
1775 myName->setMinimumWidth( metrics.width( data.myName )+5 );
1777 myStdWidget->myPhysicalMesh->setCurrentIndex( data.myPhysicalMesh );
1778 myStdWidget->myGeometricMesh->setCurrentIndex( data.myGeometricMesh );
1779 if (data.myPhySize <= 0)
1780 myStdWidget->myPhySize->setText("");
1782 myStdWidget->myPhySize->SetValue( data.myPhySize );
1783 myStdWidget->myPhySizeRel->setChecked( data.myPhySizeRel );
1784 if (data.myMinSize < 0)
1785 myStdWidget->myMinSize->setText("");
1787 myStdWidget->myMinSize->SetValue( data.myMinSize );
1788 myStdWidget->myMinSizeRel->setChecked( data.myMinSizeRel );
1789 if (data.myMaxSize < 0)
1790 myStdWidget->myMaxSize->setText("");
1792 myStdWidget->myMaxSize->SetValue( data.myMaxSize );
1793 myStdWidget->myMaxSizeRel->setChecked( data.myMaxSizeRel );
1794 myStdWidget->myUseGradation->setChecked( data.myUseGradation );
1795 if (data.myGradation <= 0 || !data.myUseGradation )
1796 myStdWidget->myGradation->setText("");
1798 myStdWidget->myGradation->SetValue( data.myGradation );
1799 myStdWidget->myUseVolumeGradation->setChecked( data.myUseVolumeGradation );
1800 if (data.myVolumeGradation <= 0 || !data.myUseVolumeGradation )
1801 myStdWidget->myVolumeGradation->setText("");
1803 myStdWidget->myVolumeGradation->SetValue( data.myVolumeGradation );
1805 foreach (QAbstractButton* button, myStdWidget->myButtonGroupElementType->buttons()) {
1806 if (myStdWidget->myButtonGroupElementType->id(button) == data.myElementType) {
1807 button->setChecked(true);
1812 if (data.myAngleMesh < 0)
1813 myStdWidget->myAngleMesh->setText("");
1815 myStdWidget->myAngleMesh->SetValue( data.myAngleMesh );
1816 if (data.myChordalError <= 0)
1817 myStdWidget->myChordalError->setText("");
1819 myStdWidget->myChordalError->SetValue( data.myChordalError );
1820 myStdWidget->myAnisotropic->setChecked( data.myAnisotropic );
1821 if (data.myAnisotropicRatio <= 0)
1822 myStdWidget->myAnisotropicRatio->setText("");
1824 myStdWidget->myAnisotropicRatio->SetValue( data.myAnisotropicRatio );
1825 myStdWidget->myRemoveTinyEdges->setChecked( data.myRemoveTinyEdges );
1826 if (data.myTinyEdgeLength <= 0)
1827 myStdWidget->myTinyEdgeLength->setText("");
1829 myStdWidget->myTinyEdgeLength->SetValue( data.myTinyEdgeLength );
1830 myStdWidget->myOptimiseTinyEdges->setChecked( data.myOptimiseTinyEdges );
1831 if (data.myTinyEdgeOptimisLength <= 0)
1832 myStdWidget->myTinyEdgeOptimisLength->setText("");
1834 myStdWidget->myTinyEdgeOptimisLength->SetValue( data.myTinyEdgeOptimisLength );
1835 myStdWidget->myCorrectSurfaceIntersection->setChecked( data.myCorrectSurfaceIntersection );
1836 if (data.myCorrectSurfaceIntersectionMaxCost <= 0)
1837 myStdWidget->myCorrectSurfaceIntersectionMaxCost->setText("");
1839 myStdWidget->myCorrectSurfaceIntersectionMaxCost->SetValue( data.myCorrectSurfaceIntersectionMaxCost );
1840 myStdWidget->myForceBadElementRemoval->setChecked( data.myForceBadElementRemoval );
1841 if (data.myBadElementAspectRatio <= 0)
1842 myStdWidget->myBadElementAspectRatio->setText("");
1844 myStdWidget->myBadElementAspectRatio->SetValue( data.myBadElementAspectRatio );
1845 myStdWidget->myOptimizeMesh->setChecked( data.myOptimizeMesh );
1846 myStdWidget->myQuadraticMesh->setChecked( data.myQuadraticMesh );
1848 myStdWidget->resizeWidgets();
1850 myAdvWidget->myVerbosity->setValue( data.myVerbosity );
1852 if ( myOptions.operator->() ) {
1853 for ( int i = 0, nb = myOptions->length(); i < nb; ++i )
1854 myAdvWidget->AddOption( TBL_MESHING, that->myOptions[i].in() );
1856 if ( myPreCADOptions.operator->() ) {
1857 for ( int i = 0, nb = myPreCADOptions->length(); i < nb; ++i )
1858 myAdvWidget->AddOption( TBL_PRECAD, that->myPreCADOptions[i].in() );
1860 if ( myCustomOptions.operator->() ) {
1861 for ( int i = 0, nb = myCustomOptions->length(); i < nb; ++i )
1862 myAdvWidget->AddOption( TBL_CUSTOM, that->myCustomOptions[i].in() );
1864 myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
1865 myAdvWidget->myGMFFileName->setText(QString(data.myGMFFileName.c_str()));
1866 // myGMFFileMode->setChecked(data.myGMFFileMode);
1869 QMapIterator<QString, QString> i(that->mySMPMap);
1870 GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
1871 while (i.hasNext()) {
1873 const QString entry = i.key();
1874 const QString sizeMap = i.value();
1875 string shapeName = myGeomToolSelected->getNameFromEntry(entry.toStdString());
1876 //int row = mySizeMapTable->topLevelItemCount();
1877 QTreeWidgetItem* item = new QTreeWidgetItem();
1878 mySizeMapTable->addTopLevelItem( item );
1879 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled );
1880 item->setData(SMP_ENTRY_COLUMN,Qt::DisplayRole, QVariant(entry) );
1881 item->setData(SMP_NAME_COLUMN, Qt::DisplayRole, QVariant( QString::fromStdString(shapeName) ) );
1882 if (that->myATTMap.contains(entry)) {
1883 TAttractorVec & attVec = that->myATTMap[entry];
1884 for ( size_t i = 0; i < attVec.size(); ++i )
1886 std::string attName = myGeomToolSelected->getNameFromEntry( attVec[i].attEntry );
1887 QTreeWidgetItem* child = new QTreeWidgetItem();
1888 item->addChild( child );
1889 item->setExpanded(true);
1890 child->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( attVec[i].startSize ));
1891 child->setData(SMP_ENTRY_COLUMN, Qt::DisplayRole, QVariant( attVec[i].attEntry.c_str() ));
1892 child->setData(SMP_NAME_COLUMN, Qt::DisplayRole, QVariant( attName.c_str() ));
1894 if ( attVec[i].infDist > std::numeric_limits<double>::epsilon()){
1895 item->setData(SMP_SIZEMAP_COLUMN, Qt::DisplayRole, QVariant( "Attractor" ));
1898 item->setData(SMP_SIZEMAP_COLUMN, Qt::DisplayRole, QVariant( "Constant Size" ));
1904 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( sizeMap ) );
1907 mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
1908 mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
1909 mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
1911 // Enforced vertices
1912 TFaceEntryEnfVertexListMap::const_iterator evmIt = data.faceEntryEnfVertexListMap.begin();
1914 for ( ; evmIt != data.faceEntryEnfVertexListMap.end() ; ++evmIt) {
1915 TEntry entry = (*evmIt).first;
1916 std::string shapeName = myGeomToolSelected->getNameFromEntry(entry);
1918 //QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
1920 TEnfVertexList evs = (*evmIt).second;
1922 TEnfVertexList::const_iterator evsIt = evs.begin();
1923 TEnfVertex *enfVertex;
1924 for ( ; evsIt != evs.end() ; ++evsIt) {
1925 enfVertex = (*evsIt);
1926 double x = 0, y = 0, z = 0;
1927 if (enfVertex->coords.size()) {
1928 x = enfVertex->coords[0];
1929 y = enfVertex->coords[1];
1930 z = enfVertex->coords[2];
1932 that->addEnforcedVertex(x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
1936 for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
1937 myEnforcedTreeWidget->resizeColumnToContents(column);
1939 myInternalEnforcedVerticesAllFaces->setChecked(data.myInternalEnforcedVerticesAllFaces);
1940 myInternalEnforcedVerticesAllFacesGroup->setText(QString(data.myInternalEnforcedVerticesAllFacesGroup.c_str()));
1941 myInternalEnforcedVerticesAllFacesGroup->setEnabled(data.myInternalEnforcedVerticesAllFaces);
1945 // Add an item in the tree widget for each association
1946 for (size_t i=0 ; i<data.preCadPeriodicityVector.size() ; i++)
1948 QTreeWidgetItem* item = new QTreeWidgetItem();
1949 myPeriodicityTreeWidget->addTopLevelItem(item);
1950 item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
1951 TPreCadPeriodicity periodicity_i = data.preCadPeriodicityVector[i];
1952 for (size_t k=0; k<periodicity_i.size(); k++)
1954 string shapeEntry = periodicity_i[k];
1955 string shapeName = myGeomToolSelected->getNameFromEntry(shapeEntry);
1956 item->setData(k, Qt::EditRole, shapeName.c_str() );
1957 item->setData(k, Qt::UserRole, shapeEntry.c_str() );
1962 for ( int i = 0; i < data.hyperpatches.size(); ++i )
1963 that->addHyPatchToTable( data.hyperpatches[i] );
1966 that->myStdWidget->onPhysicalMeshChanged();
1967 that->myStdWidget->onGeometricMeshChanged();
1968 that->onStateChange();
1971 /** BLSURFPluginGUI_HypothesisCreator::storeParams()
1972 This method updates the hypothesis data with the GUI widgets content.
1974 QString BLSURFPluginGUI_HypothesisCreator::storeParams() const
1976 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
1978 BlsurfHypothesisData data;
1979 QString guiHyp = that->readParamsFromWidgets( data );
1980 that->storeParamsToHypo( data );
1985 /** BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo(h_data)
1986 Updates the hypothesis data from hypothesis values.
1988 bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData& h_data ) const
1990 BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
1991 BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() );
1993 HypothesisData* data = SMESH::GetHypothesisData( hypType() );
1994 h_data.myName = isCreation() && data ? hypName() : "";
1996 h_data.myPhysicalMesh = (int) h->GetPhysicalMesh();
1997 h_data.myGeometricMesh = (int) h->GetGeometricMesh();
1998 h_data.myPhySize = h->GetPhySize();
1999 h_data.myPhySizeRel = h->IsPhySizeRel();
2000 double minSize = h->GetMinSize();
2001 double maxSize = h->GetMaxSize();
2002 h_data.myMinSize = minSize > 0 ? minSize : -1.0;
2003 h_data.myMinSizeRel = h->IsMinSizeRel();
2004 h_data.myMaxSize = maxSize > 0 ? maxSize : -1.0;
2005 h_data.myMaxSizeRel = h->IsMaxSizeRel();
2006 h_data.myUseGradation = h->GetUseGradation();
2007 h_data.myGradation = h->GetGradation();
2008 h_data.myUseVolumeGradation = h->GetUseVolumeGradation();
2009 h_data.myVolumeGradation = h->GetVolumeGradation();
2010 h_data.myElementType = h->GetElementType();
2011 double angle = h->GetAngleMesh();
2012 h_data.myAngleMesh = angle > 0 ? angle : -1.0;
2013 double chordalError = h->GetChordalError();
2014 h_data.myChordalError = chordalError > 0 ? chordalError : -1.0;
2015 h_data.myAnisotropic = h->GetAnisotropic();
2016 double myAnisotropicRatio = h->GetAnisotropicRatio();
2017 h_data.myAnisotropicRatio = myAnisotropicRatio > 0 ? myAnisotropicRatio : -1.0;
2018 h_data.myRemoveTinyEdges = h->GetRemoveTinyEdges();
2019 double myTinyEdgeLength = h->GetTinyEdgeLength();
2020 h_data.myTinyEdgeLength = myTinyEdgeLength > 0 ? myTinyEdgeLength : -1.0;
2021 h_data.myOptimiseTinyEdges = h->GetOptimiseTinyEdges();
2022 double myTinyEdgeOptimisLength = h->GetTinyEdgeOptimisationLength();
2023 h_data.myTinyEdgeOptimisLength = myTinyEdgeOptimisLength > 0 ? myTinyEdgeOptimisLength : -1.0;
2024 h_data.myCorrectSurfaceIntersection = h->GetCorrectSurfaceIntersection();
2025 double corrSurfaceIntersMaxCost = h->GetCorrectSurfaceIntersectionMaxCost();
2026 h_data.myCorrectSurfaceIntersectionMaxCost = corrSurfaceIntersMaxCost > 0 ? corrSurfaceIntersMaxCost : -1.0;
2027 h_data.myForceBadElementRemoval = h->GetBadElementRemoval();
2028 double myBadElementAspectRatio = h->GetBadElementAspectRatio();
2029 h_data.myBadElementAspectRatio = myBadElementAspectRatio > 0 ? myBadElementAspectRatio : -1.0;
2030 h_data.myOptimizeMesh = h->GetOptimizeMesh();
2031 h_data.myQuadraticMesh = h->GetQuadraticMesh();
2032 h_data.myVerbosity = h->GetVerbosity();
2033 //h_data.myTopology = (int) h->GetTopology();
2034 //h_data.myPreCADMergeEdges = h->GetPreCADMergeEdges();
2035 // h_data.myPreCADProcess3DTopology = h->GetPreCADProcess3DTopology();
2036 // h_data.myPreCADDiscardInput = h->GetPreCADDiscardInput();
2039 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2040 that->myOptions = h->GetOptionValues();
2041 that->myPreCADOptions = h->GetPreCADOptionValues();
2042 that->myCustomOptions = h->GetAdvancedOptionValues();
2044 h_data.myGMFFileName = h->GetGMFFile();
2045 // h_data.myGMFFileMode = h->GetGMFFileMode();
2047 that->mySMPMap.clear();
2048 that->myATTMap.clear();
2049 // that->myAttDistMap.clear();
2050 // that->myDistMap.clear();
2052 // classic size maps
2053 BLSURFPlugin::string_array_var mySizeMaps = h->GetSizeMapEntries();
2054 QString fullSizeMaps;
2055 QStringList fullSizeMapList;
2056 GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
2057 for ( CORBA::ULong i = 0;i<mySizeMaps->length(); ++i ) {
2058 fullSizeMaps = mySizeMaps[i].in();
2059 fullSizeMapList = fullSizeMaps.split( "|", QString::KeepEmptyParts );
2060 if ( fullSizeMapList.count() > 1 ) {
2061 string fullSizeMap = fullSizeMapList[1].toStdString();
2062 int pos = fullSizeMap.find("return")+7;
2065 sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos));
2070 that->mySMPMap[fullSizeMapList[0]] = sizeMap;
2071 that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShapeType(fullSizeMapList[0].toStdString());
2077 BLSURFPlugin::string_array_var myCustomSizeMaps = h->GetCustomSizeMapEntries();
2079 for ( int i = 0;i<myCustomSizeMaps->length(); ++i ) {
2080 QString fullCustomSizeMaps = myCustomSizeMaps[i].in();
2081 QStringList fullCustomSizeMapList = fullCustomSizeMaps.split( "|", QString::KeepEmptyParts );
2082 if ( fullCustomSizeMapList.count() > 1 ) {
2083 that->mySMPMap[fullCustomSizeMapList[0]] = fullCustomSizeMapList[1];
2084 that->mySMPShapeTypeMap[fullCustomSizeMapList[0]] = GeomToolSelected->entryToShapeType(fullCustomSizeMapList[0].toStdString());
2089 BLSURFPlugin::string_array_var allMyAttractors = h->GetAttractorEntries();
2091 for ( CORBA::ULong i = 0;i<allMyAttractors->length(); ++i ) {
2092 QString myAttractors = allMyAttractors[i].in();
2093 QStringList myAttractorList = myAttractors.split( "|", QString::KeepEmptyParts );
2094 if ( myAttractorList.count() > 1 ) {
2095 that->mySMPMap[myAttractorList[0]] = myAttractorList[1];
2096 that->mySMPShapeTypeMap[myAttractorList[0]] = myGeomToolSelected->entryToShapeType(myAttractorList[0].toStdString());
2100 // attractor new version
2101 BLSURFPlugin::TAttParamsMap_var allMyAttractorParams = h->GetAttractorParams();
2102 for ( CORBA::ULong i = 0;i<allMyAttractorParams->length(); ++i ) {
2103 BLSURFPlugin::TAttractorParams myAttractorParams = allMyAttractorParams[i];
2104 QString faceEntry = myAttractorParams.faceEntry.in();
2105 QString attEntry = myAttractorParams.attEntry.in();
2106 that->mySMPMap[faceEntry] = QString::number( myAttractorParams.startSize, 'g', 6 ); // TODO utiliser les préférences ici (cf. sketcher)
2107 that->mySMPShapeTypeMap[faceEntry] = myGeomToolSelected->entryToShapeType(faceEntry.toStdString());
2108 that->myATTMap[faceEntry].push_back( TAttractor( myAttractorParams.attEntry.in(),
2109 myAttractorParams.startSize,
2110 myAttractorParams.infDist,
2111 myAttractorParams.constDist ));
2114 // Enforced vertices
2115 h_data.enfVertexList.clear();
2116 h_data.faceEntryEnfVertexListMap.clear();
2118 h_data.groupNameEnfVertexListMap.clear();
2121 BLSURFPlugin::TFaceEntryEnfVertexListMap_var faceEntryEnfVertexListMap = h->GetAllEnforcedVerticesByFace();
2123 for ( CORBA::ULong i = 0;i<faceEntryEnfVertexListMap->length(); ++i )
2125 std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in();
2126 BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList;
2128 for (CORBA::ULong j=0 ; j<vertexList.length(); ++j)
2130 TEnfVertex *enfVertex = new TEnfVertex();
2131 enfVertex->name = vertexList[j].name.in();
2132 enfVertex->geomEntry = vertexList[j].geomEntry.in();
2133 enfVertex->grpName = vertexList[j].grpName.in();
2134 for (CORBA::ULong k=0 ; k< vertexList[j].coords.length();k++)
2135 enfVertex->coords.push_back(vertexList[j].coords[k]);
2137 h_data.faceEntryEnfVertexListMap[entry].insert(enfVertex);
2140 if (groupName != "") {
2141 h_data.groupNameEnfVertexListMap[groupName].insert(ev);
2145 // h_data.enfVertMap[entry] = evs;
2146 // h_data.entryCoordsListMap[entry] = coordsList;
2148 if (h_data.faceEntryEnfVertexListMap[entry].size() == 0) {
2149 h_data.faceEntryEnfVertexListMap.erase(entry);
2152 h_data.myInternalEnforcedVerticesAllFaces = h->GetInternalEnforcedVertexAllFaces();
2153 h_data.myInternalEnforcedVerticesAllFacesGroup = h->GetInternalEnforcedVertexAllFacesGroup();
2157 h_data.preCadPeriodicityVector.clear();
2159 BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector = h->GetPreCadFacesPeriodicityVector();
2160 AddPreCadSequenceToVector(h_data, preCadFacePeriodicityVector, true);
2162 BLSURFPlugin::TPeriodicityList_var preCadEdgePeriodicityVector = h->GetPreCadEdgesPeriodicityVector();
2163 AddPreCadSequenceToVector(h_data, preCadEdgePeriodicityVector, false);
2167 h_data.hyperpatches.clear();
2168 BLSURFPlugin::THyperPatchList_var patchList = h->GetHyperPatches();
2169 for ( CORBA::ULong i = 0; i < patchList->length(); ++i )
2172 BLSURFPlugin::THyperPatch& patch = patchList[i];
2173 for ( CORBA::ULong j = 0; j < patch.length(); ++j )
2174 tags += QString::number( patch[j] ) + " ";
2175 if ( !tags.isEmpty() )
2176 h_data.hyperpatches.append( tags );
2182 void BLSURFPluginGUI_HypothesisCreator::AddPreCadSequenceToVector(BlsurfHypothesisData& h_data,
2183 BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector, bool onFace) const
2186 for (size_t i=0; i<preCadFacePeriodicityVector->length(); i++ )
2188 TPreCadPeriodicity periodicity_i(PERIODICITY_NB_COLUMN);
2189 periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN] = preCadFacePeriodicityVector[i].shape1Entry.in();
2190 periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN] = preCadFacePeriodicityVector[i].shape2Entry.in();
2192 BLSURFPlugin::TEntryList sourceVertices = preCadFacePeriodicityVector[i].theSourceVerticesEntries;
2193 BLSURFPlugin::TEntryList targetVertices = preCadFacePeriodicityVector[i].theTargetVerticesEntries;
2195 if (sourceVertices.length()!=0)
2197 periodicity_i[PERIODICITY_P1_SOURCE_COLUMN] = sourceVertices[0].in();
2198 periodicity_i[PERIODICITY_P2_SOURCE_COLUMN] = sourceVertices[1].in();
2199 periodicity_i[PERIODICITY_P3_SOURCE_COLUMN] = sourceVertices[2].in();
2202 if (targetVertices.length()!=0)
2204 periodicity_i[PERIODICITY_P1_TARGET_COLUMN] = targetVertices[0].in();
2205 periodicity_i[PERIODICITY_P2_TARGET_COLUMN] = targetVertices[1].in();
2206 periodicity_i[PERIODICITY_P3_TARGET_COLUMN] = targetVertices[2].in();
2210 periodicity_i[PERIODICITY_SHAPE_TYPE] = "1";
2212 periodicity_i[PERIODICITY_SHAPE_TYPE] = "0";
2214 h_data.preCadPeriodicityVector.push_back(periodicity_i);
2218 /** BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo(h_data)
2219 Saves the hypothesis data to hypothesis values.
2221 bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesisData& h_data ) const
2223 BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
2224 BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
2230 SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
2232 if ( h->GetPhysicalMesh() != h_data.myPhysicalMesh ) // avoid duplication of DumpPython commands
2233 h->SetPhysicalMesh( (int) h_data.myPhysicalMesh );
2234 if ( h->GetGeometricMesh() != (int) h_data.myGeometricMesh )
2235 h->SetGeometricMesh( (int) h_data.myGeometricMesh );
2237 if ( ((int) h_data.myPhysicalMesh == PhysicalGlobalSize)||((int) h_data.myPhysicalMesh == PhysicalLocalSize) ) {
2238 if ( h->GetPhySize() != h_data.myPhySize ||
2239 h->IsPhySizeRel() != h_data.myPhySizeRel ) {
2240 if ( h_data.myPhySizeRel )
2241 h->SetPhySizeRel( h_data.myPhySize );
2243 h->SetPhySize( h_data.myPhySize );
2246 if (h->GetMinSize() != h_data.myMinSize ||
2247 h->IsMinSizeRel() != h_data.myMinSizeRel ) {
2248 if ( h_data.myMinSizeRel )
2249 h->SetMinSizeRel( h_data.myMinSize <= 0 ? -1 : h_data.myMinSize );
2251 h->SetMinSize( h_data.myMinSize <= 0 ? -1 : h_data.myMinSize );
2253 if (h->GetMaxSize() != h_data.myMaxSize ||
2254 h->IsMaxSizeRel() != h_data.myMaxSizeRel ) {
2255 if ( h_data.myMaxSizeRel )
2256 h->SetMaxSizeRel( h_data.myMaxSize <= 0 ? -1 : h_data.myMaxSize );
2258 h->SetMaxSize( h_data.myMaxSize <= 0 ? -1 : h_data.myMaxSize );
2260 if ( h->GetUseGradation() != h_data.myUseGradation )
2261 h->SetUseGradation( h_data.myUseGradation );
2262 if ( h->GetGradation() != h_data.myGradation )
2263 h->SetGradation( h_data.myGradation <= 0 ? -1 : h_data.myGradation );
2264 if ( h->GetUseVolumeGradation() != h_data.myUseVolumeGradation )
2265 h->SetUseVolumeGradation( h_data.myUseVolumeGradation );
2266 if ( h->GetVolumeGradation() != h_data.myVolumeGradation )
2267 h->SetVolumeGradation( h_data.myVolumeGradation <= 0 ? -1 : h_data.myVolumeGradation );
2269 if ( h->GetElementType() != h_data.myElementType )
2270 h->SetElementType( h_data.myElementType );
2272 if ( (int) h_data.myGeometricMesh != DefaultGeom ) {
2273 if ( h->GetAngleMesh() != h_data.myAngleMesh )
2274 h->SetAngleMesh( h_data.myAngleMesh <= 0 ? -1 :h_data.myAngleMesh );
2275 if ( h->GetChordalError() != h_data.myChordalError )
2276 h->SetChordalError( h_data.myChordalError <= 0 ? -1 :h_data.myChordalError );
2279 if ( h->GetAnisotropic() != h_data.myAnisotropic )
2280 h->SetAnisotropic( h_data.myAnisotropic );
2281 if ( h_data.myAnisotropic && ( h->GetAnisotropicRatio() != h_data.myAnisotropicRatio ) )
2282 h->SetAnisotropicRatio( h_data.myAnisotropicRatio <= 0 ? -1 :h_data.myAnisotropicRatio );
2284 if ( h->GetRemoveTinyEdges() != h_data.myRemoveTinyEdges )
2285 h->SetRemoveTinyEdges( h_data.myRemoveTinyEdges );
2286 if ( h_data.myRemoveTinyEdges && ( h->GetTinyEdgeLength() != h_data.myTinyEdgeLength ) )
2287 h->SetTinyEdgeLength( h_data.myTinyEdgeLength <= 0 ? -1 :h_data.myTinyEdgeLength );
2289 if ( h->GetOptimiseTinyEdges() != h_data.myOptimiseTinyEdges )
2290 h->SetOptimiseTinyEdges( h_data.myOptimiseTinyEdges );
2291 if ( h_data.myOptimiseTinyEdges && ( h->GetTinyEdgeOptimisationLength() != h_data.myTinyEdgeOptimisLength ) )
2292 h->SetTinyEdgeOptimisationLength( h_data.myTinyEdgeOptimisLength <= 0 ? -1 :h_data.myTinyEdgeOptimisLength );
2293 if ( h->GetCorrectSurfaceIntersection() != h_data.myCorrectSurfaceIntersection )
2294 h->SetCorrectSurfaceIntersection( h_data.myCorrectSurfaceIntersection );
2295 if ( h_data.myCorrectSurfaceIntersection && ( h->GetCorrectSurfaceIntersectionMaxCost() != h_data.myCorrectSurfaceIntersectionMaxCost ) )
2296 h->SetCorrectSurfaceIntersectionMaxCost( h_data.myCorrectSurfaceIntersectionMaxCost <= 0 ? -1 :h_data.myCorrectSurfaceIntersectionMaxCost );
2298 if ( h->GetBadElementRemoval() != h_data.myForceBadElementRemoval )
2299 h->SetBadElementRemoval( h_data.myForceBadElementRemoval );
2300 if ( h_data.myForceBadElementRemoval && ( h->GetBadElementAspectRatio() != h_data.myBadElementAspectRatio ) )
2301 h->SetBadElementAspectRatio( h_data.myBadElementAspectRatio <= 0 ? -1 :h_data.myBadElementAspectRatio );
2303 if ( h->GetOptimizeMesh() != h_data.myOptimizeMesh )
2304 h->SetOptimizeMesh( h_data.myOptimizeMesh );
2306 if ( h->GetQuadraticMesh() != h_data.myQuadraticMesh )
2307 h->SetQuadraticMesh( h_data.myQuadraticMesh );
2309 if ( h->GetVerbosity() != h_data.myVerbosity )
2310 h->SetVerbosity( h_data.myVerbosity );
2311 // if ( h->GetTopology() != h_data.myTopology )
2312 // h->SetTopology( (int) h_data.myTopology );
2313 // if ( h->GetPreCADMergeEdges() != h_data.myPreCADMergeEdges )
2314 // h->SetPreCADMergeEdges( h_data.myPreCADMergeEdges );
2315 // if ( h->GetPreCADProcess3DTopology() != h_data.myPreCADProcess3DTopology )
2316 // h->SetPreCADProcess3DTopology( h_data.myPreCADProcess3DTopology );
2317 // if ( h->GetPreCADDiscardInput() != h_data.myPreCADDiscardInput )
2318 // h->SetPreCADDiscardInput( h_data.myPreCADDiscardInput );
2320 // options are set in checkParams()
2321 //h->SetOptionValues( myOptions ); // is set in readParamsFromWidgets()
2322 //h->SetPreCADOptionValues( myPreCADOptions ); // is set in readParamsFromWidgets()
2324 if ( h->GetGMFFile() != h_data.myGMFFileName )
2325 // || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
2326 // h->SetGMFFile( h_data.myGMFFileName.c_str(), h_data.myGMFFileMode );
2327 h->SetGMFFile( h_data.myGMFFileName.c_str());
2329 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2330 QMapIterator<QString,QString> i(that->mySMPMap);
2331 while (i.hasNext()) {
2333 const QString entry = i.key();
2334 const QString sizeMap = i.value();
2336 if (sizeMap == "__TO_DELETE__") {
2337 h->UnsetEntry(entry.toLatin1().constData());
2339 else if (sizeMap.startsWith("ATTRACTOR")) {
2340 h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData());
2342 else if (sizeMap.startsWith("def")) {
2343 // h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
2346 if (!myATTMap[entry].empty()){
2347 const TAttractorVec& attVec = myATTMap[entry];
2348 for ( size_t i = 0; i < attVec.size(); ++i )
2350 if ( attVec[i].IsToDelete() )
2351 h->UnsetAttractorEntry( entry.toLatin1().constData(),
2352 attVec[i].attEntry.c_str() );
2354 h->SetClassAttractorEntry( entry.toLatin1().constData(),
2355 attVec[i].attEntry.c_str(),
2356 attVec[i].startSize,
2359 attVec[i].constDist );
2363 QString fullSizeMap;
2364 fullSizeMap = QString("");
2365 if (that->mySMPShapeTypeMap[entry] == TopAbs_FACE)
2366 fullSizeMap = QString("def f(u,v): return ") + sizeMap;
2367 else if (that->mySMPShapeTypeMap[entry] == TopAbs_EDGE)
2368 fullSizeMap = QString("def f(t): return ") + sizeMap;
2369 else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX)
2370 fullSizeMap = QString("def f(): return ") + sizeMap;
2371 h->SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() );
2376 // Enforced vertices
2379 std::string enfName;
2381 std::string groupName = "";
2384 TFaceEntryEnfVertexListMap::const_iterator evmIt = h_data.faceEntryEnfVertexListMap.begin();
2385 // 1. Clear all enforced vertices in hypothesis
2386 // 2. Add new enforced vertex according to h_data
2388 if ( h->GetAllEnforcedVertices()->length() > 0 )
2389 h->ClearAllEnforcedVertices();
2392 TEnfVertexList::const_iterator evsIt;
2393 for ( ; evmIt != h_data.faceEntryEnfVertexListMap.end() ; ++evmIt)
2395 faceEntry = evmIt->first;
2396 evs = evmIt->second;
2397 evsIt = evs.begin();
2398 for ( ; evsIt != evs.end() ; ++evsIt)
2401 if ((*evsIt)->coords.size()) {
2402 x = (*evsIt)->coords[0];
2403 y = (*evsIt)->coords[1];
2404 z = (*evsIt)->coords[2];
2407 h->SetEnforcedVertexEntry( faceEntry.c_str(), x, y, z, (*evsIt)->name.c_str(), (*evsIt)->geomEntry.c_str(), (*evsIt)->grpName.c_str());
2411 if ( h->GetInternalEnforcedVertexAllFaces() != h_data.myInternalEnforcedVerticesAllFaces )
2412 h->SetInternalEnforcedVertexAllFaces( h_data.myInternalEnforcedVerticesAllFaces );
2413 if ( h->GetInternalEnforcedVertexAllFacesGroup() != h_data.myInternalEnforcedVerticesAllFacesGroup )
2414 h->SetInternalEnforcedVertexAllFacesGroup( h_data.myInternalEnforcedVerticesAllFacesGroup.c_str() );
2417 if ( h->GetPreCadFacesPeriodicityVector()->length() > 0 || h->GetPreCadEdgesPeriodicityVector()->length() > 0 )
2418 h->ClearPreCadPeriodicityVectors();
2420 TPreCadPeriodicityVector::const_iterator pIt = h_data.preCadPeriodicityVector.begin();
2421 for ( ; pIt != h_data.preCadPeriodicityVector.end() ; ++pIt)
2423 TPreCadPeriodicity periodicity_i = *pIt;
2424 TEntry source = periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN];
2425 TEntry target = periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN];
2426 TEntry p1Source = periodicity_i[PERIODICITY_P1_SOURCE_COLUMN];
2427 TEntry p2Source = periodicity_i[PERIODICITY_P2_SOURCE_COLUMN];
2428 TEntry p3Source = periodicity_i[PERIODICITY_P3_SOURCE_COLUMN];
2429 TEntry p1Target = periodicity_i[PERIODICITY_P1_TARGET_COLUMN];
2430 TEntry p2Target = periodicity_i[PERIODICITY_P2_TARGET_COLUMN];
2431 TEntry p3Target = periodicity_i[PERIODICITY_P3_TARGET_COLUMN];
2432 bool onFace = (periodicity_i[PERIODICITY_SHAPE_TYPE]=="1") ? true : false;
2434 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2435 if (! p1Source.empty())
2437 sourceVertices->length(3);
2438 sourceVertices[0]=CORBA::string_dup(p1Source.c_str());
2439 sourceVertices[1]=CORBA::string_dup(p2Source.c_str());
2440 sourceVertices[2]=CORBA::string_dup(p3Source.c_str());
2444 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2445 if (! p1Target.empty())
2447 targetVertices->length(3);
2448 targetVertices[0]=CORBA::string_dup(p1Target.c_str());
2449 targetVertices[1]=CORBA::string_dup(p2Target.c_str());
2450 targetVertices[2]=CORBA::string_dup(p3Target.c_str());
2454 h->AddPreCadFacesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
2456 h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
2460 BLSURFPlugin::THyperPatchList_var hpl = new BLSURFPlugin::THyperPatchList();
2461 hpl->length( h_data.hyperpatches.size() );
2463 for ( int i = 0; i < h_data.hyperpatches.size(); ++i )
2465 QStringList tags = h_data.hyperpatches[i].split(" ", QString::SkipEmptyParts);
2466 BLSURFPlugin::THyperPatch& patch = hpl[ i ];
2467 patch.length( tags.size() );
2469 for ( int j = 0; j < tags.size(); ++j )
2470 patch[ j ] = tags[ j ].toDouble();
2472 h->SetHyperPatches( hpl );
2483 /** BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets(h_data)
2484 Stores the widgets content to the hypothesis data.
2486 QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const
2488 h_data.myName = myName ? myName->text() : "";
2489 h_data.myPhysicalMesh = myStdWidget->myPhysicalMesh->currentIndex();
2490 h_data.myGeometricMesh = myStdWidget->myGeometricMesh->currentIndex();
2491 h_data.myPhySize = myStdWidget->myPhySize->text().isEmpty() ? -1.0 : myStdWidget->myPhySize->GetValue();
2492 h_data.myPhySizeRel = myStdWidget->myPhySizeRel->isChecked();
2493 h_data.myMinSize = myStdWidget->myMinSize->text().isEmpty() ? -1.0 : myStdWidget->myMinSize->GetValue();
2494 h_data.myMinSizeRel = myStdWidget->myMinSizeRel->isChecked();
2495 h_data.myMaxSize = myStdWidget->myMaxSize->text().isEmpty() ? -1.0 : myStdWidget->myMaxSize->GetValue();
2496 h_data.myMaxSizeRel = myStdWidget->myMaxSizeRel->isChecked();
2497 h_data.myUseGradation = myStdWidget->myUseGradation->isChecked() && !myStdWidget->myGradation->text().isEmpty();
2498 h_data.myGradation = h_data.myUseGradation ? myStdWidget->myGradation->GetValue() : -1.0;
2499 h_data.myUseVolumeGradation = myStdWidget->myUseVolumeGradation->isChecked() && !myStdWidget->myVolumeGradation->text().isEmpty();
2500 h_data.myVolumeGradation = h_data.myUseVolumeGradation ? myStdWidget->myVolumeGradation->GetValue() : -1. ;
2501 h_data.myElementType = myStdWidget->myButtonGroupElementType->checkedId();
2502 h_data.myAngleMesh = myStdWidget->myAngleMesh->text().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue();
2503 h_data.myChordalError = myStdWidget->myChordalError->text().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue();
2504 h_data.myAnisotropic = myStdWidget->myAnisotropic->isChecked();
2505 h_data.myAnisotropicRatio = myStdWidget->myAnisotropicRatio->text().isEmpty() ? -1.0 : myStdWidget->myAnisotropicRatio->GetValue();
2506 h_data.myRemoveTinyEdges = myStdWidget->myRemoveTinyEdges->isChecked();
2507 h_data.myTinyEdgeLength = myStdWidget->myTinyEdgeLength->text().isEmpty() ? -1.0 : myStdWidget->myTinyEdgeLength->GetValue();
2508 h_data.myOptimiseTinyEdges = myStdWidget->myOptimiseTinyEdges->isChecked();
2509 h_data.myTinyEdgeOptimisLength = myStdWidget->myTinyEdgeOptimisLength->text().isEmpty() ? -1.0 : myStdWidget->myTinyEdgeOptimisLength->GetValue();
2510 h_data.myCorrectSurfaceIntersection = myStdWidget->myCorrectSurfaceIntersection->isChecked();
2511 h_data.myCorrectSurfaceIntersectionMaxCost = myStdWidget->myCorrectSurfaceIntersectionMaxCost->text().isEmpty() ? -1.0 : myStdWidget->myCorrectSurfaceIntersectionMaxCost->GetValue();
2512 h_data.myForceBadElementRemoval= myStdWidget->myForceBadElementRemoval->isChecked();
2513 h_data.myBadElementAspectRatio = myStdWidget->myBadElementAspectRatio->text().isEmpty() ? -1.0 : myStdWidget->myBadElementAspectRatio->GetValue();
2514 h_data.myOptimizeMesh = myStdWidget->myOptimizeMesh->isChecked();
2515 h_data.myQuadraticMesh = myStdWidget->myQuadraticMesh->isChecked();
2516 h_data.myVerbosity = myAdvWidget->myVerbosity->value();
2517 //h_data.myTopology = myAdvWidget->myPreCADGroupBox->isChecked() ? PreCAD : FromCAD;
2518 //h_data.myPreCADMergeEdges = myAdvWidget->myPreCADMergeEdges->isChecked();
2519 //h_data.myPreCADProcess3DTopology = myAdvWidget->myPreCADProcess3DTopology->isChecked();
2520 //h_data.myPreCADDiscardInput = myAdvWidget->myPreCADDiscardInput->isChecked();
2523 guiHyp += tr("BLSURF_PHY_MESH") + " = " + QString::number( h_data.myPhysicalMesh ) + "; ";
2524 guiHyp += tr("BLSURF_GEOM_MESH") + " = " + QString::number( h_data.myGeometricMesh ) + "; ";
2525 guiHyp += tr("BLSURF_HPHYDEF") + " = " + QString::number( h_data.myPhySize ) + "; ";
2526 guiHyp += tr("BLSURF_HPHYDEF") + " " + tr("BLSURF_SIZE_REL") +" = " + QString(h_data.myPhySizeRel ? "yes" : "no") + "; ";
2527 guiHyp += tr("BLSURF_MINSIZE") + " = "+ QString::number( h_data.myMinSize ) + "; ";
2528 guiHyp += tr("BLSURF_MINSIZE") + " " + tr("BLSURF_SIZE_REL") + " = " + QString(h_data.myMinSizeRel ? "yes" : "no") + "; ";
2529 guiHyp += tr("BLSURF_MAXSIZE") + " = "+ QString::number( h_data.myMaxSize ) + "; ";
2530 guiHyp += tr("BLSURF_MAXSIZE") + " " + tr("BLSURF_SIZE_REL") + " = " + QString(h_data.myMaxSizeRel ? "yes" : "no") + "; ";
2531 guiHyp += tr("BLSURF_GRADATION") + " = " + QString::number( h_data.myGradation ) + "; ";
2532 guiHyp += tr("BLSURF_ELEMENT_TYPE") + " = " + QString::number(h_data.myElementType) + "; ";
2533 guiHyp += tr("BLSURF_ANGLE_MESH") + " = " + QString::number( h_data.myAngleMesh ) + "; ";
2534 guiHyp += tr("BLSURF_CHORDAL_ERROR") + " = " + QString::number( h_data.myChordalError ) + "; ";
2535 guiHyp += tr("BLSURF_ANISOTROPIC") + " = " + QString(h_data.myAnisotropic ? "yes" : "no") + "; ";
2536 guiHyp += tr("BLSURF_ANISOTROPIC_RATIO") + " = " + QString::number( h_data.myAnisotropicRatio ) + "; ";
2539 guiHyp += tr("BLSURF_REMOVE_TINY_EDGES") + " = " + QString(h_data.myRemoveTinyEdges ? "yes" : "no") + "; ";
2540 guiHyp += tr("BLSURF_TINY_EDGES_LENGTH") + " = " + QString::number( h_data.myTinyEdgeLength ) + "; ";
2541 guiHyp += tr("BLSURF_REMOVE_SLIVERS") + " = " + QString(h_data.myForceBadElementRemoval ? "yes" : "no") + "; ";
2542 guiHyp += tr("BLSURF_BAD_SURFACE_ELEMENT_ASPECT_RATIO") + " = " + QString::number( h_data.myBadElementAspectRatio ) + "; ";
2543 guiHyp += tr("BLSURF_OPTIMISATION") + " = " + QString(h_data.myOptimizeMesh ? "yes" : "no") + "; ";
2544 guiHyp += tr("BLSURF_ELEMENT_ORDER") + " = " + QString(h_data.myQuadraticMesh ? "yes" : "no") + "; ";
2547 // guiHyp += tr("BLSURF_TOPOLOGY") + " = " + QString::number( h_data.myTopology ) + "; ";
2548 // guiHyp += tr("BLSURF_PRECAD_MERGE_EDGES") + " = " + QString(h_data.myPreCADMergeEdges ? "yes" : "no") + "; ";
2549 // guiHyp += tr("BLSURF_PRECAD_REMOVE_NANO_EDGES") + " = " + QString(h_data.myPreCADProcess3DTopology ? "yes" : "no") + "; ";
2550 // guiHyp += tr("BLSURF_PRECAD_DISCARD_INPUT") + " = " + QString(h_data.myPreCADDiscardInput ? "yes" : "no") + "; ";
2552 h_data.myGMFFileName = myAdvWidget->myGMFFileName->text().toStdString();
2553 // h_data.myGMFFileMode = myGMFFileMode->isChecked();
2556 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2557 int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
2558 for ( ; row < nbRows; ++row )
2560 QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
2561 if ( that->mySMPMap.contains(entry) )
2562 guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); ";
2565 // Enforced vertices
2566 h_data.enfVertexList.clear();
2567 h_data.faceEntryEnfVertexListMap.clear();
2569 int nbEnforcedShapes = myEnforcedTreeWidget->topLevelItemCount();
2570 std::string groupName = "", faceEntry = "";
2571 for (int i=0 ; i<nbEnforcedShapes ; i++)
2573 double childValueX,childValueY,childValueZ;
2574 std::string childName, vertexEntry;
2575 QTreeWidgetItem* child;
2577 child = myEnforcedTreeWidget->topLevelItem(i);
2578 childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
2579 childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
2580 childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
2581 childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
2582 vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
2583 // if (myGlobalGroupName->isChecked())
2584 // groupName = myGlobalGroupName->text().toStdString();
2586 groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString();
2588 TEnfVertex *enfVertex = new TEnfVertex();
2589 enfVertex->name = childName;
2590 if (vertexEntry.empty()) {
2591 enfVertex->coords.push_back(childValueX);
2592 enfVertex->coords.push_back(childValueY);
2593 enfVertex->coords.push_back(childValueZ);
2596 enfVertex->geomEntry = vertexEntry;
2597 enfVertex->grpName = groupName;
2598 // TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex);
2599 // if (it == h_data.enfVertexList.end())
2600 h_data.enfVertexList.insert(enfVertex);
2602 if (groupName != "")
2603 h_data.groupNameEnfVertexListMap[groupName].insert(vertex);
2605 h_data.faceEntryEnfVertexListMap[faceEntry].insert( enfVertex );
2608 h_data.myInternalEnforcedVerticesAllFaces = myInternalEnforcedVerticesAllFaces->isChecked();
2609 h_data.myInternalEnforcedVerticesAllFacesGroup = myInternalEnforcedVerticesAllFacesGroup->text().toStdString();
2612 h_data.preCadPeriodicityVector.clear();
2613 // For each tree item, store each value. Shapes are stored as entries.
2614 int nbPeriodicityDescriptions = myPeriodicityTreeWidget->topLevelItemCount();
2615 for (int i=0 ; i<nbPeriodicityDescriptions ; i++) {
2616 QTreeWidgetItem* item = myPeriodicityTreeWidget->topLevelItem(i);
2617 TPreCadPeriodicity periodicity_i;
2619 for (int k=0; k<myPeriodicityTreeWidget->columnCount(); ++k)
2621 std::string entry = item->data(k, Qt::UserRole).toString().toStdString();
2622 periodicity_i.push_back(entry);
2624 h_data.preCadPeriodicityVector.push_back(periodicity_i);
2626 guiHyp += "PERIODICITY = yes; ";
2630 h_data.hyperpatches.clear();
2631 for ( int row = 0; row < myHyPatchTable->rowCount(); ++row )
2632 h_data.hyperpatches.append( myHyPatchTable->item( row, 0 )->text() );
2637 void BLSURFPluginGUI_HypothesisCreator::onAddOption()
2639 myAdvWidget->AddOption( TBL_CUSTOM, NULL );
2642 void BLSURFPluginGUI_HypothesisCreator::onChangeOptionName( int row, int column )
2644 // if ( column != OPTION_NAME_COLUMN )
2646 // myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
2649 // **********************
2650 // *** BEGIN SIZE MAP ***
2651 // **********************
2653 void BLSURFPluginGUI_HypothesisCreator::onMapGeomContentModified()
2655 if ( myGeomSelWdg2->IsObjectSelected() ){
2656 mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
2658 else if ( myGeomSelWdg1->IsObjectSelected() ){
2659 mySMapObject = myGeomSelWdg1->GetObject< GEOM::GEOM_Object >(0);
2662 mySMapObject = GEOM::GEOM_Object::_nil();
2664 bool dataAvailable = !mySMapObject->_is_nil();
2666 if ( dataAvailable )
2667 qEntry = SMESH::toQStr( mySMapObject->GetStudyEntry() );
2669 bool mapExists = ( mySMPMap.contains(qEntry) && mySMPMap[qEntry] != "__TO_DELETE__" );
2670 if (( mapExists && myGeomSelWdg2->IsObjectSelected() ) &&
2671 ( dataAvailable = myAttSelWdg->isEnabled() ) &&
2672 ( dataAvailable = myAttSelWdg->IsObjectSelected() ) &&
2673 ( myATTMap.contains( qEntry )))
2676 QString attEntry = myAttSelWdg->GetValue();
2677 const TAttractorVec& attVec = myATTMap[ qEntry ];
2678 for ( size_t i = 0; i < attVec.size() && !mapExists; ++i )
2679 mapExists = ( attEntry == attVec[i].attEntry.c_str() );
2682 addMapButton->setEnabled( !mapExists && dataAvailable );
2683 modifyMapButton->setEnabled( mapExists && dataAvailable );
2686 void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item, int col)
2688 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2689 if (col == SMP_SIZEMAP_COLUMN) {
2690 QString entry = item->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
2692 if (!mySMPMap.contains(entry))
2694 if ( QTreeWidgetItem* parent = item->parent() )
2698 entry = item->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
2700 if (!mySMPMap.contains(entry))
2703 QString sizeMap = item->data( SMP_SIZEMAP_COLUMN, Qt::EditRole ).toString();
2704 CORBA::Object_var obj = entryToObject(entry);
2705 if (sizeMap.startsWith("Attractor") || sizeMap.startsWith("Constant")) { // ADVANCED MAPS
2706 smpTab->setCurrentIndex(ATT_TAB); // Change Tab
2707 // Retrieve values of the selected item in the current tab widgets
2708 const TAttractorVec& attVec = myATTMap[entry];
2709 if ( !attVec.empty() )
2712 if ( !childEntry.isEmpty() )
2713 for ( size_t i = 0; i < attVec.size(); ++i )
2714 if ( childEntry == attVec[i].attEntry.c_str() )
2719 double phySize = attVec[iAtt].startSize;
2720 double infDist = attVec[iAtt].infDist;
2721 double constDist = attVec[iAtt].constDist;
2722 QString attEntry = attVec[iAtt].attEntry.c_str();
2723 CORBA::Object_var attObj = entryToObject(attEntry);
2724 myAttSizeSpin->setValue(phySize);
2725 if ( infDist > std::numeric_limits<double>::epsilon() /*sizeMap.startsWith("Attractor")*/){
2726 myAttDistSpin->setValue(infDist);
2727 myAttractorCheck->setChecked(true);
2730 myAttractorCheck->setChecked(false);
2732 if (/*sizeMap.startsWith("Constant") || */constDist > std::numeric_limits<double>::epsilon()){
2733 myAttDistSpin2->setValue(constDist);
2734 myConstSizeCheck->setChecked(true);
2737 myConstSizeCheck->setChecked(false);
2739 myGeomSelWdg2->SetObject(obj);
2740 myAttSelWdg->SetObject(attObj);
2743 else { // CLASSIC MAPS
2744 smpTab->setCurrentIndex(SMP_STD_TAB); // Change Tab
2745 myGeomSelWdg1->SetObject(obj); // Retrieve values of the selected item in the current tab widgets
2746 if (!sizeMap.startsWith("def")){
2747 mySmpSizeSpin->setValue(that->mySMPMap[entry].toDouble());
2753 void BLSURFPluginGUI_HypothesisCreator::onTabChanged(int tab)
2755 getGeomSelectionTool()->selectionMgr()->clearFilters();
2756 if ( sender() == myTabWidget )
2758 myGeomSelWdg1 ->deactivateSelection();
2759 myGeomSelWdg2 ->deactivateSelection();
2760 myAttSelWdg ->deactivateSelection();
2761 myEnfVertexWdg ->deactivateSelection();
2762 myPeriodicitySourceFaceWdg->deactivateSelection();
2763 myPeriodicityTargetFaceWdg->deactivateSelection();
2764 myPeriodicityP1SourceWdg ->deactivateSelection();
2765 myPeriodicityP2SourceWdg ->deactivateSelection();
2766 myPeriodicityP3SourceWdg ->deactivateSelection();
2767 myPeriodicityP1TargetWdg ->deactivateSelection();
2768 myPeriodicityP2TargetWdg ->deactivateSelection();
2769 myPeriodicityP3TargetWdg ->deactivateSelection();
2770 if ( myHyPatchFaceSelBtn->isChecked() )
2771 myHyPatchFaceSelBtn->toggle();
2772 if ( myHyPatchGroupSelBtn->isChecked() )
2773 myHyPatchGroupSelBtn->toggle();
2776 else if ( sender() == smpTab )
2778 myAttDistSpin->setValue(0.); // Reinitialize widgets
2779 myAttSizeSpin->setValue(0.);
2780 myAttDistSpin2->setValue(0.);
2781 mySmpSizeSpin->setValue(0.);
2782 myGeomSelWdg1->deactivateSelection();
2783 myGeomSelWdg2->deactivateSelection();
2784 myAttSelWdg->deactivateSelection();
2785 myGeomSelWdg1->SetObject(CORBA::Object::_nil());
2786 myGeomSelWdg2->SetObject(CORBA::Object::_nil());
2787 myAttSelWdg->SetObject(CORBA::Object::_nil());
2788 myAttractorCheck->setChecked(false);
2789 myConstSizeCheck->setChecked(false);
2793 void BLSURFPluginGUI_HypothesisCreator::onAttractorClicked(int state)
2795 if (state == Qt::Checked){
2796 myAttSelWdg->setEnabled(true);
2797 myAttSizeSpin->setEnabled(true);
2798 myAttSizeLabel->setEnabled(true);
2799 myAttDistSpin->setEnabled(true);
2800 myAttDistLabel->setEnabled(true);
2801 if (!myAttSelWdg->IsObjectSelected()){
2802 myAttSelWdg->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }");
2805 if (state == Qt::Unchecked){
2806 myAttDistSpin->setEnabled(false);
2807 myAttDistLabel->setEnabled(false);
2808 myAttDistSpin->setValue(0.);
2809 if(myConstSizeCheck->checkState() == Qt::Unchecked){ // No predefined map selected
2810 myAttSelWdg->setEnabled(false);
2811 myAttSizeSpin->setEnabled(false);
2812 myAttSizeLabel->setEnabled(false);
2813 myAttDistSpin2->setEnabled(false);
2814 myAttDistLabel2->setEnabled(false);
2816 else if (!myAttSelWdg->IsObjectSelected()){ // Only constant size selected
2817 myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
2820 onMapGeomContentModified();
2823 void BLSURFPluginGUI_HypothesisCreator::onConstSizeClicked(int state)
2825 if (state == Qt::Checked){
2826 myAttSelWdg->setEnabled(true);
2827 myAttSizeSpin->setEnabled(true);
2828 myAttSizeLabel->setEnabled(true);
2829 myAttDistSpin2->setEnabled(true);
2830 myAttDistLabel2->setEnabled(true);
2831 if (myAttractorCheck->checkState() == Qt::Unchecked &&
2832 !myAttSelWdg->IsObjectSelected()){
2833 myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
2836 if (state == Qt::Unchecked){
2837 myAttDistSpin2->setEnabled(false);
2838 myAttDistLabel2->setEnabled(false);
2839 myAttDistSpin2->setValue(0.);
2840 if(myAttractorCheck->checkState() == Qt::Unchecked){ // No predefined map selected
2841 myAttSelWdg->setEnabled(false);
2842 myAttSizeSpin->setEnabled(false);
2843 myAttSizeLabel->setEnabled(false);
2844 myAttDistSpin->setEnabled(false);
2845 myAttDistLabel->setEnabled(false);
2847 else if (!myAttSelWdg->IsObjectSelected()){ // Only constant size selected
2848 myAttSelWdg->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }");
2851 onMapGeomContentModified();
2854 void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
2856 QList<int> selectedRows;
2857 QList<QTreeWidgetItem*> selected = mySizeMapTable->selectedItems();
2858 QTreeWidgetItem* item;
2859 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2861 qSort( selectedRows );
2862 QListIterator<QTreeWidgetItem*> it( selected );
2864 while ( it.hasPrevious() ) {
2865 item = it.previous();
2866 QString entry = item->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
2867 QString parentEntry;
2868 if ( QTreeWidgetItem* parent = item->parent() )
2869 parentEntry = parent->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
2870 if (that->mySMPMap.contains(entry))
2872 that->mySMPMap[entry] = "__TO_DELETE__";
2873 if ( myATTMap.contains( entry ))
2875 TAttractorVec& attVec = myATTMap[entry];
2876 for ( size_t i = 0; i < attVec.size(); ++i )
2877 attVec[i].SetToDelete();
2880 else if ( mySMPMap.contains( parentEntry ) && myATTMap.contains( parentEntry ))
2882 TAttractorVec& attVec = myATTMap[parentEntry];
2883 for ( size_t i = 0; i < attVec.size(); ++i )
2885 if ( entry == attVec[i].attEntry.c_str() )
2886 attVec[i].SetToDelete();
2889 if (that->mySMPShapeTypeMap.contains(entry))
2890 that->mySMPShapeTypeMap.remove(entry);
2891 // if (that->myDistMap.contains(entry))
2892 // that->myDistMap.remove(entry);
2893 // if (that->myAttDistMap.contains(entry))
2894 // that->myAttDistMap.remove(entry);
2897 mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN);
2898 mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
2901 void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(QTreeWidgetItem* item, int col)
2903 if (col == SMP_SIZEMAP_COLUMN) {
2904 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
2905 QString entry = item->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
2906 QString sizeMap = item->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
2907 if (! that->mySMPShapeTypeMap.contains(entry))
2909 if (that->mySMPMap.contains(entry))
2910 if (that->mySMPMap[entry] == sizeMap
2911 || sizeMap.startsWith("Attractor")
2912 || sizeMap.startsWith("Constant") ){
2915 if (! sizeMap.isEmpty()) {
2916 that->mySMPMap[entry] = sizeMap;
2917 sizeMapValidationFromEntry(entry);
2920 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(that->mySMPMap[entry]) );
2922 mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
2926 void BLSURFPluginGUI_HypothesisCreator::onAddMap()
2929 if ( smpTab->currentIndex() == ATT_TAB ){
2930 if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){
2931 mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
2932 myAttObject = myAttSelWdg->GetObject< GEOM::GEOM_Object >(0);
2933 res = insertAttractor(mySMapObject, myAttObject);
2936 if (smpTab->currentIndex() == SMP_STD_TAB ){
2937 if ( myGeomSelWdg1->IsObjectSelected() ){
2938 mySMapObject = myGeomSelWdg1->GetObject< GEOM::GEOM_Object >(0);
2939 res = insertElement(mySMapObject);
2943 // Local size should be more than 0
2944 QString msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_SM_SIZE"));
2945 SUIT_MessageBox::critical( dlg(),"Error" , msg );
2948 getGeomSelectionTool()->selectionMgr()->clearFilters();
2949 myAttDistSpin->setValue(0.);
2950 myAttSizeSpin->setValue(0.);
2951 myAttDistSpin2->setValue(0.);
2952 mySmpSizeSpin->setValue(0.);
2953 myConstSizeCheck->setChecked(false);
2954 myAttractorCheck->setChecked(false);
2955 myGeomSelWdg1->deactivateSelection();
2956 myGeomSelWdg2->deactivateSelection();
2957 myAttSelWdg->deactivateSelection();
2958 myGeomSelWdg1->SetObject(CORBA::Object::_nil());
2959 myGeomSelWdg2->SetObject(CORBA::Object::_nil());
2960 myAttSelWdg->SetObject(CORBA::Object::_nil());
2963 void BLSURFPluginGUI_HypothesisCreator::onModifyMap()
2966 if ( smpTab->currentIndex() == ATT_TAB ){
2967 if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){
2968 mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
2969 myAttObject = myAttSelWdg->GetObject< GEOM::GEOM_Object >(0);
2970 res = insertAttractor(mySMapObject, myAttObject, /*modify = */true);
2973 if (smpTab->currentIndex() == SMP_STD_TAB ){
2974 if ( myGeomSelWdg1->IsObjectSelected() ){
2975 mySMapObject = myGeomSelWdg1->GetObject< GEOM::GEOM_Object >(0);
2976 res = insertElement(mySMapObject, /*modify = */true);
2980 // Local size should be more than 0
2981 QString msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_SM_SIZE"));
2982 SUIT_MessageBox::critical( dlg(),"Error" , msg );
2985 getGeomSelectionTool()->selectionMgr()->clearFilters();
2986 myAttDistSpin->setValue(0.);
2987 myAttSizeSpin->setValue(0.);
2988 myAttDistSpin2->setValue(0.);
2989 mySmpSizeSpin->setValue(0.);
2990 myConstSizeCheck->setChecked(false);
2991 myAttractorCheck->setChecked(false);
2992 myGeomSelWdg1->deactivateSelection();
2993 myGeomSelWdg2->deactivateSelection();
2994 myAttSelWdg->deactivateSelection();
2995 myGeomSelWdg1->SetObject(CORBA::Object::_nil());
2996 myGeomSelWdg2->SetObject(CORBA::Object::_nil());
2997 myAttSelWdg->SetObject(CORBA::Object::_nil());
3000 bool BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anObject, bool modify)
3002 // BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
3003 // BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
3005 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
3007 TopAbs_ShapeEnum shapeType;
3008 string entry, shapeName;
3009 entry = (string) anObject->GetStudyEntry();
3010 shapeName = anObject->GetName();
3011 shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( anObject ).ShapeType();
3012 // Group management : the type of entities in the group is stored in the SMPShapeTypeMap
3013 // in order to write the size map with the right syntax in StoreParamsToHypo
3014 // (f(t) for edges, f(u,v) for faces ...)
3015 if (shapeType == TopAbs_COMPOUND){
3016 TopoDS_Shape theShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( anObject );
3017 TopoDS_Shape childShape;
3018 TopoDS_Iterator anIt(theShape);
3019 for(;anIt.More();anIt.Next()){
3020 childShape = anIt.Value();
3021 shapeType = childShape.ShapeType();
3022 if(!childShape.IsNull()){
3027 mySizeMapTable->setFocus();
3029 shapeEntry = QString::fromStdString(entry);
3030 double phySize = mySmpSizeSpin->value();
3033 return false; // Local size should be more than 0
3035 std::ostringstream oss;
3038 sizeMap = QString::fromStdString(oss.str());
3039 QTreeWidgetItem* item = new QTreeWidgetItem();
3041 int rowToChange = findRowFromEntry(shapeEntry);
3042 item = mySizeMapTable->topLevelItem( rowToChange );
3045 if (that->mySMPMap.contains(shapeEntry)) {
3046 if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
3050 mySizeMapTable->addTopLevelItem(item);
3052 that->mySMPMap[shapeEntry] = sizeMap;
3053 //that->myDistMap[shapeEntry] = 0. ;
3054 that->mySMPShapeTypeMap[shapeEntry] = shapeType;
3055 item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable |Qt::ItemIsEnabled );
3056 item->setData(SMP_ENTRY_COLUMN, Qt::EditRole, QVariant(shapeEntry) );
3057 item->setData(SMP_NAME_COLUMN, Qt::EditRole, QVariant(QString::fromStdString(shapeName)) );
3058 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(sizeMap) );
3059 mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
3060 mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
3061 mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
3062 mySizeMapTable->clearSelection();
3064 if ( myStdWidget->myPhysicalMesh->currentIndex() != PhysicalLocalSize ) {
3065 myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize );
3066 myStdWidget->onPhysicalMeshChanged();
3071 bool BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool modify)
3073 BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
3074 BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
3076 TopAbs_ShapeEnum shapeType;
3077 string entry, attEntry, faceName, attName;
3078 entry = (string) aFace->GetStudyEntry();
3079 attEntry = (string) anAttractor->GetStudyEntry();
3080 faceName = aFace->GetName();
3081 attName = anAttractor->GetName();
3082 shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aFace ).ShapeType();
3083 mySizeMapTable->setFocus();
3084 QString shapeEntry = QString::fromStdString(entry);
3085 QString qAttEntry = QString::fromStdString(attEntry);
3087 double phySize = h->GetPhySize();
3088 double infDist = 0. ;
3089 double constDist = 0. ;
3090 phySize = myAttSizeSpin->value();
3093 return false; // Local size should be more than 0
3095 if (myAttractorCheck->isChecked()){
3096 infDist = myAttDistSpin->value();
3098 if (myConstSizeCheck->isChecked()){
3099 constDist = myAttDistSpin2->value();
3101 std::ostringstream oss;
3102 std::ostringstream oss2;
3103 std::ostringstream oss3;
3107 QString sizeMap = QString::fromStdString(oss.str());
3108 QString infDistString = QString::fromStdString(oss2.str());
3109 QString constDistString = QString::fromStdString(oss3.str());
3111 QTreeWidgetItem* item;
3112 QTreeWidgetItem* child = 0;
3113 TAttractor attParams( attEntry.c_str(), phySize, infDist, constDist );
3115 int rowToChange = findRowFromEntry(shapeEntry);
3116 item = mySizeMapTable->topLevelItem( rowToChange );
3118 for ( int i = 0, nb = item->childCount(); i < nb; ++i )
3119 if (( child = item->child( i )))
3120 if ( qAttEntry == child->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString() )
3122 TAttractorVec & attVec = myATTMap[shapeEntry];
3123 for ( size_t i = 0; i < attVec.size(); ++i )
3124 if ( attVec[i].attEntry == attEntry )
3126 attVec[i] = attParams;
3131 // if (that->mySMPMap.contains(shapeEntry)) {
3132 // if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
3136 int rowToChange = findRowFromEntry(shapeEntry);
3137 if ( rowToChange < mySizeMapTable->topLevelItemCount() )
3139 item = mySizeMapTable->topLevelItem( rowToChange );
3142 item = new QTreeWidgetItem();
3143 mySizeMapTable->addTopLevelItem(item);
3145 child = new QTreeWidgetItem();
3146 item->addChild(child);
3147 bool exists = false;
3148 TAttractorVec & attVec = myATTMap[shapeEntry];
3149 for ( size_t i = 0; i < attVec.size(); ++i )
3150 if ( attVec[i].attEntry == attEntry )
3152 attVec[i] = attParams;
3157 myATTMap[shapeEntry].push_back( attParams );
3159 mySMPMap.insert(shapeEntry,sizeMap);
3160 mySMPShapeTypeMap.insert(shapeEntry,shapeType);
3161 item->setExpanded(true);
3162 item->setData(SMP_ENTRY_COLUMN, Qt::EditRole, QVariant(shapeEntry) );
3163 item->setData(SMP_NAME_COLUMN, Qt::EditRole, QVariant(QString::fromStdString(faceName)) );
3164 if (infDist > std::numeric_limits<double>::epsilon()){
3165 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(QString::fromStdString("Attractor")) );
3167 else if (constDist > std::numeric_limits<double>::epsilon()){
3168 item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(QString::fromStdString("Constant Size")) );
3170 item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable |Qt::ItemIsEnabled );
3172 child->setData(SMP_ENTRY_COLUMN, Qt::EditRole, QVariant(qAttEntry) );
3173 child->setData(SMP_NAME_COLUMN, Qt::EditRole, QVariant(QString::fromStdString(attName)) );
3174 child->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(sizeMap) );
3176 mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
3177 mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
3178 mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
3180 if ( myStdWidget->myPhysicalMesh->currentIndex() != PhysicalLocalSize ) {
3181 myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize );
3182 myStdWidget->onPhysicalMeshChanged();
3187 bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()
3189 int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
3190 for ( ; row < nbRows; ++row )
3191 if (! sizeMapValidationFromRow(row))
3196 bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool displayError)
3198 QString myEntry = mySizeMapTable->topLevelItem( myRow )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
3199 bool res = sizeMapValidationFromEntry(myEntry,displayError);
3200 mySizeMapTable->setFocus();
3204 bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEntry, bool displayError)
3207 BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
3209 if (! that->mySMPMap.contains(myEntry)) {
3212 if (! that->mySMPShapeTypeMap.contains(myEntry)) {
3218 if (that->mySMPMap[myEntry].startsWith("def")) {
3219 expr = that->mySMPMap[myEntry].toStdString();
3221 else if (that->mySMPMap[myEntry].startsWith("ATTRACTOR")) {
3222 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)) {
3225 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])" );
3231 // case size map is empty
3232 if (that->mySMPMap[myEntry].isEmpty()) {
3234 SUIT_MessageBox::warning( dlg(),"Definition of size map : Error" , "Size map can't be empty");
3238 if ( that->mySMPShapeTypeMap[myEntry] == TopAbs_FACE)
3239 expr = "def f(u,v) : return " + that->mySMPMap[myEntry].toStdString();
3240 else if ( that->mySMPShapeTypeMap[myEntry] == TopAbs_EDGE)
3241 expr = "def f(t) : return " + that->mySMPMap[myEntry].toStdString();
3242 else if ( that->mySMPShapeTypeMap[myEntry] == TopAbs_VERTEX)
3243 expr = "def f() : return " + that->mySMPMap[myEntry].toStdString();
3246 //assert(Py_IsInitialized());
3247 if (! Py_IsInitialized())
3248 throw ("Erreur: Python interpreter is not initialized");
3249 PyGILState_STATE gstate;
3250 gstate = PyGILState_Ensure();
3252 string err_description="";
3253 PyObject* obj= PyRun_String(expr.c_str(), Py_file_input, main_dict, NULL);
3257 PyObject* new_stderr = newPyStdOut(err_description);
3258 PyObject* old_stderr = PySys_GetObject((char*)"stderr");
3259 Py_INCREF(old_stderr);
3260 PySys_SetObject((char*)"stderr", new_stderr);
3262 PySys_SetObject((char*)"stderr", old_stderr);
3263 Py_DECREF(new_stderr);
3265 SUIT_MessageBox::warning( dlg(),"Definition of Python Function : Error" ,err_description.c_str() );
3266 PyGILState_Release(gstate);
3271 PyObject* func = PyObject_GetAttrString(main_mod, "f");
3275 PyObject* new_stderr = newPyStdOut(err_description);
3276 PyObject* old_stderr = PySys_GetObject((char*)"stderr");
3277 Py_INCREF(old_stderr);
3278 PySys_SetObject((char*)"stderr", new_stderr);
3280 PySys_SetObject((char*)"stderr", old_stderr);
3281 Py_DECREF(new_stderr);
3283 SUIT_MessageBox::warning( dlg(),"Python Error" ,err_description.c_str() );
3284 PyGILState_Release(gstate);
3288 PyGILState_Release(gstate);
3294 //================================================================================
3296 * \brief SLOT: Activate selection of faces in the Viewer
3298 //================================================================================
3300 void BLSURFPluginGUI_HypothesisCreator::onHyPatchFaceSelection(bool on)
3302 if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
3304 QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
3305 QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
3306 myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
3308 myHyPatchFaceSelector->setVisible( on ); // show its buttons
3309 myHyPatchFaceSelector->ShowPreview( on ); // show faces in the Viewer
3310 // treat selection or not
3311 myHyPatchFaceSelector->ActivateSelection( on || myHyPatchGroupSelBtn->isChecked() );
3314 myHyPatchGroupSelBtn->setChecked( false );
3317 //================================================================================
3319 * \brief SLOT: Deactivate selection of faces in the Viewer
3321 //================================================================================
3323 void BLSURFPluginGUI_HypothesisCreator::onHyPatchGroupSelection(bool on)
3325 if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
3327 QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
3328 QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
3329 myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
3331 if ( !myHyPatchFaceSelBtn->isChecked() )
3333 myHyPatchFaceSelector->setVisible( false ); // show its buttons
3334 myHyPatchFaceSelector->ShowPreview( false ); // show faces in the Viewer
3336 // treat selection or not
3337 myHyPatchFaceSelector->ActivateSelection( on || myHyPatchFaceSelBtn->isChecked() );
3340 myHyPatchFaceSelBtn->setChecked( false );
3343 //================================================================================
3345 * \brief SLOT: show IDs of selected faces in Tags LineEdit
3347 //================================================================================
3349 void BLSURFPluginGUI_HypothesisCreator::onHyPatchSelectionChanged()
3352 const QList<int>& tags = myHyPatchFaceSelector->GetSelectedIDs();
3353 for ( int i = 0; i < tags.size(); ++i )
3354 tagString += QString::number( tags[i] ) + " ";
3356 myHyPatchTagsLE->setText( tagString );
3359 //================================================================================
3361 * \brief SLOT: Add the Tags to the HyperPatch table
3363 //================================================================================
3365 void BLSURFPluginGUI_HypothesisCreator::onHyPatchAdd()
3367 QStringList tagList = myHyPatchTagsLE->text().split(" ", QString::SkipEmptyParts);
3368 if ( tagList.size() > 1 )
3370 addHyPatchToTable( myHyPatchTagsLE->text() );
3371 myHyPatchTagsLE->setText("");
3375 //================================================================================
3377 * \brief Add a row to myHyPatchTable
3379 //================================================================================
3381 void BLSURFPluginGUI_HypothesisCreator::addHyPatchToTable(const QString& tags)
3383 if ( tags.isEmpty() ) return;
3385 QTableWidgetItem* cell = new QTableWidgetItem( tags );
3386 cell->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
3388 int row = myHyPatchTable->rowCount();
3389 myHyPatchTable->insertRow( row );
3390 myHyPatchTable->setItem( row, 0, cell );
3393 //================================================================================
3395 * \brief SLOT: remove selected rows from the HyperPatch table
3397 //================================================================================
3399 void BLSURFPluginGUI_HypothesisCreator::onHyPatchRemove()
3401 QList<QTableWidgetItem *> items = myHyPatchTable->selectedItems();
3402 while ( !items.isEmpty() )
3404 myHyPatchTable->removeRow( items[0]->row() );
3405 items = myHyPatchTable->selectedItems();
3409 bool BLSURFPluginGUI_HypothesisCreator::hasGeom() const
3411 return hypType() == BLSURFPlugin_Hypothesis::GetHypType(true);
3414 QString BLSURFPluginGUI_HypothesisCreator::caption() const
3416 return tr( "BLSURF_TITLE" );
3419 QPixmap BLSURFPluginGUI_HypothesisCreator::icon() const
3421 return SUIT_Session::session()->resourceMgr()->loadPixmap( "BLSURFPlugin", tr( "ICON_DLG_BLSURF_PARAMETERS") );
3424 QString BLSURFPluginGUI_HypothesisCreator::type() const
3426 return tr( "BLSURF_HYPOTHESIS" );
3429 QString BLSURFPluginGUI_HypothesisCreator::helpPage() const
3431 return "blsurf_hypo_page.html";
3434 LightApp_SelectionMgr* BLSURFPluginGUI_HypothesisCreator::selectionMgr()
3437 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
3439 return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
3444 CORBA::Object_var BLSURFPluginGUI_HypothesisCreator::entryToObject(QString entry)
3446 SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
3447 SALOMEDS::Study_var myStudy = smeshGen_i->GetCurrentStudy();
3448 CORBA::Object_var obj;
3449 SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.toStdString().c_str() );
3450 if (!aSObj->_is_nil()) {
3451 obj = aSObj->GetObject();
3452 aSObj->UnRegister();
3457 int BLSURFPluginGUI_HypothesisCreator::findRowFromEntry(QString entry){
3458 int endRow = mySizeMapTable->topLevelItemCount()-1;
3460 for ( ; row <= endRow; ++row )
3462 QString entryForChecking = mySizeMapTable->topLevelItem( row )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
3463 if (entry == entryForChecking )