X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGUI%2FHexoticPluginGUI_HypothesisCreator.cxx;h=08013982089d0c10ab34a3f554cdb22fb66b6177;hb=61f5866508a334ee45f89ffa9febef261d982b4a;hp=2d3e8f63302bb16c7aa9a9998aad659d41162a6e;hpb=9505068ceaa446f76e771824a29c6160e0f34578;p=plugins%2Fhexoticplugin.git diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx index 2d3e8f6..0801398 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -27,12 +27,11 @@ #include #include -#include "SMESH_NumberFilter.hxx" +#include +#include #include "utilities.h" -#include CORBA_SERVER_HEADER(HexoticPlugin_Algorithm) - #include #include #include @@ -58,6 +57,7 @@ // Main widget tabs identification enum { STD_TAB = 0, + ADV_TAB, SMP_TAB, VL_TAB }; @@ -119,9 +119,9 @@ void SizeMapsTableWidgetDelegate::updateEditorGeometry(QWidget *editor, HexoticPluginGUI_HypothesisCreator::HexoticPluginGUI_HypothesisCreator( const QString& theHypType ) -: SMESHGUI_GenericHypothesisCreator( theHypType ), - myIs3D( true ), - mySizeMapsToRemove() + : SMESHGUI_GenericHypothesisCreator( theHypType ), + myIs3D( true ), + mySizeMapsToRemove() { } @@ -133,30 +133,68 @@ bool HexoticPluginGUI_HypothesisCreator::checkParams(QString& msg) const { msg.clear(); + HexoticPlugin::HexoticPlugin_Hypothesis_var h = + HexoticPlugin::HexoticPlugin_Hypothesis::_narrow( hypothesis() ); + + myAdvWidget->myOptionTable->setFocus(); + QApplication::instance()->processEvents(); + + QString name, value; + bool isDefault, ok = true; + int iRow = 0, nbRows = myAdvWidget->myOptionTable->topLevelItemCount(); + for ( ; iRow < nbRows; ++iRow ) + { + QTreeWidgetItem* row = myAdvWidget->myOptionTable->topLevelItem( iRow ); + myAdvWidget->GetOptionAndValue( row, name, value, isDefault ); + + if ( name.simplified().isEmpty() ) + continue; // invalid custom option + + if ( isDefault ) // not selected option + value.clear(); + + try { + h->SetOptionValue( name.toLatin1().constData(), value.toLatin1().constData() ); + } + catch ( const SALOME::SALOME_Exception& ex ) + { + msg = ex.details.text.in(); + ok = false; + break; + } + } + + if ( !ok ) + { + h->SetOptionValues( myOptions ); // restore values + return false; + } + HexoticHypothesisData data_old, data_new; - readParamsFromHypo( data_old ); - + readParamsFromHypo( data_old ); // new values of advanced options ( myOptions ) are read + bool res = readParamsFromWidgets( data_new ); if ( !res ){ return res; } - res = storeParamsToHypo( data_new ); + + res = data_old.myMinSize <= data_old.myMaxSize; if ( !res ) { - storeParamsToHypo( data_old ); + msg = tr(QString("Min size (%1) is higher than max size (%2)").arg(data_old.myMinSize).arg(data_old.myMaxSize).toStdString().c_str()); return res; } - res = data_new.myMinSize <= data_new.myMaxSize; + res = data_old.myHexesMinLevel == 0 || \ + ( data_old.myHexesMinLevel != 0 && (data_old.myHexesMinLevel < data_old.myHexesMaxLevel) ); if ( !res ) { - msg = tr(QString("Min size (%1) is higher than max size (%2)").arg(data_new.myMinSize).arg(data_new.myMaxSize).toStdString().c_str()); + msg = tr(QString("Min hexes level (%1) is higher than max hexes level (%2)").arg(data_old.myHexesMinLevel).arg(data_old.myHexesMaxLevel).toStdString().c_str()); return res; } - res = data_new.myHexesMinLevel == 0 || \ - ( data_new.myHexesMinLevel != 0 && (data_new.myHexesMinLevel < data_new.myHexesMaxLevel) ); + res = storeParamsToHypo( data_new ); if ( !res ) { - msg = tr(QString("Min hexes level (%1) is higher than max hexes level (%2)").arg(data_new.myHexesMinLevel).arg(data_new.myHexesMaxLevel).toStdString().c_str()); + storeParamsToHypo( data_old ); return res; } @@ -169,7 +207,7 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() QVBoxLayout* lay = new QVBoxLayout( fr ); lay->setMargin( 0 ); lay->setSpacing( 6 ); - + // main TabWidget of the dialog QTabWidget* aTabWidget = new QTabWidget( fr ); aTabWidget->setTabShape( QTabWidget::Rounded ); @@ -181,7 +219,7 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() QGridLayout* l = new QGridLayout( aStdGroup ); l->setSpacing( 6 ); l->setMargin( 11 ); - + int row = 0; myName = 0; if( isCreation() ) { @@ -191,42 +229,35 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() myName->setMinimumWidth( 150 ); } - HexoticPlugin::HexoticPlugin_Hypothesis_var h = - HexoticPlugin::HexoticPlugin_Hypothesis::_narrow( initParamsHypothesis() ); - myStdWidget = new HexoticPluginGUI_StdWidget(aStdGroup); -#ifdef WIN32 - myStdWidget->label_6->hide(); - myStdWidget->myHexoticNbProc->hide(); -#endif l->addWidget( myStdWidget, row++, 0, 1, 3 ); myStdWidget->onSdModeSelected(SD_MODE_4); + //myStdWidget->gridLayout->setRowStretch( 1, 2 ); + + // Advanced TAB + myAdvWidget = new HexoticPluginGUI_AdvWidget( aTabWidget ); + //myAdvWidget->gridLayout->setRowStretch( 0, 2 ); - // SIZE MAPS TAB - QWidget* aSmpGroup = new QWidget(); - lay->addWidget( aSmpGroup ); - - // Size map widget creation and initialisation - mySmpWidget = new HexoticPluginGUI_SizeMapsWidget(aSmpGroup); + mySmpWidget = new HexoticPluginGUI_SizeMapsWidget( aTabWidget ); mySmpWidget->doubleSpinBox->RangeStepAndValidator(0.0, COORD_MAX, 1.0, "length_precision"); mySmpWidget->doubleSpinBox->setValue(0.0); - + // Filters of selection - TColStd_MapOfInteger SM_ShapeTypes; + TColStd_MapOfInteger SM_ShapeTypes; SM_ShapeTypes.Add( TopAbs_VERTEX ); SM_ShapeTypes.Add( TopAbs_EDGE ); SM_ShapeTypes.Add( TopAbs_WIRE ); SM_ShapeTypes.Add( TopAbs_FACE ); SM_ShapeTypes.Add( TopAbs_SOLID ); - SM_ShapeTypes.Add( TopAbs_COMPOUND ); + SM_ShapeTypes.Add( TopAbs_COMPOUND ); SMESH_NumberFilter* aFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, SM_ShapeTypes); - + // Selection widget myGeomSelWdg = new StdMeshersGUI_ObjectReferenceParamWdg( aFilter, mySmpWidget, /*multiSel=*/false); myGeomSelWdg->SetDefaultText(tr("Hexotic_SEL_SHAPE"), "QLineEdit { color: grey }"); mySmpWidget->gridLayout->addWidget(myGeomSelWdg, 0, 1); - + // Configuration of the table widget QStringList headerLabels; headerLabels << tr("Hexotic_ENTRY")<< tr("Hexotic_NAME")<< tr("Hexotic_SIZE"); @@ -236,22 +267,16 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() mySmpWidget->label->setText(tr("LOCAL_SIZE")); mySmpWidget->pushButton_1->setText(tr("Hexotic_ADD")); mySmpWidget->pushButton_2->setText(tr("Hexotic_REMOVE")); - + // Setting a custom delegate for the size column SizeMapsTableWidgetDelegate* delegate = new SizeMapsTableWidgetDelegate(); mySmpWidget->tableWidget->setItemDelegateForColumn(SIZE_COL, delegate); - - // Add the size maps widget to a layout - QHBoxLayout* aSmpLayout = new QHBoxLayout( aSmpGroup ); - aSmpLayout->setMargin( 0 ); - aSmpLayout->addWidget( mySmpWidget); - + + // Viscous Layers tab - QWidget* aVLGroup = new QWidget(); - lay->addWidget( aVLGroup ); // Viscous layers widget creation and initialisation - myVLWidget = new HexoticPluginGUI_ViscousLayersWidget(aVLGroup); + myVLWidget = new HexoticPluginGUI_ViscousLayersWidget( aTabWidget ); QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); @@ -263,48 +288,43 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() } else { - myVLWidget->labelFacesWithLayers->setVisible(false); + myVLWidget->labelFacesWithLayers->setVisible(false); myVLWidget->myFacesWithLayers->setVisible(false); myVLWidget->labelImprintedFaces->setVisible(false); myVLWidget->myImprintedFaces->setVisible(false); } - // Add the viscous layers widget to a layout - QHBoxLayout* aVLLayout = new QHBoxLayout( aVLGroup ); - aVLLayout->setSpacing( 6 ); - aVLLayout->setMargin( 11 ); - aVLLayout->addWidget( myVLWidget ); + aTabWidget->insertTab( STD_TAB, aStdGroup, tr( "SMESH_ARGUMENTS" )); + aTabWidget->insertTab( ADV_TAB, myAdvWidget, tr( "SMESH_ADVANCED" )); + aTabWidget->insertTab( SMP_TAB, mySmpWidget, tr( "LOCAL_SIZE" )); + aTabWidget->insertTab( VL_TAB, myVLWidget, tr( "Hexotic_VISCOUS_LAYERS")); -// resizeEvent(); - - aTabWidget->insertTab( STD_TAB, aStdGroup, tr( "SMESH_ARGUMENTS" ) ); - aTabWidget->insertTab( SMP_TAB, aSmpGroup, tr( "LOCAL_SIZE" ) ); - aTabWidget->insertTab( VL_TAB, aVLGroup, tr( "Hexotic_VISCOUS_LAYERS") ); - myIs3D = true; - + // Size Maps mySizeMapsToRemove.clear(); connect( mySmpWidget->pushButton_1, SIGNAL( clicked() ), this, SLOT( onAddLocalSize() ) ); connect( mySmpWidget->pushButton_2, SIGNAL( clicked() ), this, SLOT( onRemoveLocalSize() ) ); connect( aTabWidget, SIGNAL( currentChanged(int)), this, SLOT( onTabChanged( int ) ) ); + connect( myAdvWidget->addBtn, SIGNAL( clicked() ), this, SLOT( onAddOption() ) ); + connect( myAdvWidget->dirBtn, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) ); return fr; } void HexoticPluginGUI_HypothesisCreator::onAddLocalSize() { int rowCount = mySmpWidget->tableWidget->rowCount(); - int columnCount = mySmpWidget->tableWidget->columnCount(); - + //int columnCount = mySmpWidget->tableWidget->columnCount(); + // Get the selected object properties GEOM::GEOM_Object_var sizeMapObject = myGeomSelWdg->GetObject< GEOM::GEOM_Object >(0); if (sizeMapObject->_is_nil()) return; - + std::string entry, shapeName; entry = (std::string) sizeMapObject->GetStudyEntry(); shapeName = sizeMapObject->GetName(); - + // Check if the object is already in the widget QList listFound = mySmpWidget->tableWidget ->findItems( QString(entry.c_str()), Qt::MatchExactly ); @@ -328,7 +348,7 @@ void HexoticPluginGUI_HypothesisCreator::insertLocalSizeInWidget( std::string en double size, int row ) const { - MESSAGE("HexoticPluginGUI_HypothesisCreator:insertLocalSizeInWidget") + MESSAGE("HexoticPluginGUI_HypothesisCreator:insertLocalSizeInWidget"); int columnCount = mySmpWidget->tableWidget->columnCount(); // Add a row at the end of the table @@ -364,7 +384,7 @@ void HexoticPluginGUI_HypothesisCreator::onRemoveLocalSize() { // Remove the selected rows in the table QList ranges = mySmpWidget->tableWidget->selectedRanges(); - if ( ranges.isEmpty() ) // If none is selected remove the last one + if ( ranges.isEmpty() && mySmpWidget->tableWidget->rowCount() > 0) // If none is selected remove the last one { int lastRow = mySmpWidget->tableWidget->rowCount() - 1; std::string entry = mySmpWidget->tableWidget->item( lastRow, ENTRY_COL )->text().toStdString(); @@ -380,7 +400,7 @@ void HexoticPluginGUI_HypothesisCreator::onRemoveLocalSize() { std::string entry = mySmpWidget->tableWidget->item( row, ENTRY_COL )->text().toStdString(); mySizeMapsToRemove.push_back(entry); - MESSAGE("ADDING entry : "<tableWidget->model()->removeRows(it->topRow(), it->rowCount()); } @@ -409,6 +429,8 @@ void HexoticPluginGUI_HypothesisCreator::retrieveParams() const if( myName ) myName->setText( data.myName ); + myStdWidget->myPhySizeType->setCurrentIndex( data.myMinSize > 0 || data.myMaxSize > 0 ); + myStdWidget->myMinSize->setCleared(data.myMinSize == 0); if (data.myMinSize == 0) myStdWidget->myMinSize->setText(""); @@ -421,38 +443,35 @@ void HexoticPluginGUI_HypothesisCreator::retrieveParams() const else myStdWidget->myMaxSize->setValue( data.myMaxSize ); - myStdWidget->myHexesMinLevel->setCleared(data.myHexesMinLevel == 0); - if (data.myHexesMinLevel == 0) - myStdWidget->myHexesMinLevel->setText(""); - else - myStdWidget->myHexesMinLevel->setValue( data.myHexesMinLevel ); + myStdWidget->myGeomSizeType->setCurrentIndex( data.myApproxAngle > 0 ); - myStdWidget->myHexesMaxLevel->setCleared(data.myHexesMaxLevel == 0); - if (data.myHexesMaxLevel == 0) - myStdWidget->myHexesMaxLevel->setText(""); + myStdWidget->myGeomApproxAngle->setCleared( data.myApproxAngle == 0 ); + if (data.myApproxAngle == 0) + myStdWidget->myGeomApproxAngle->setText(""); else - myStdWidget->myHexesMaxLevel->setValue( data.myHexesMaxLevel ); + myStdWidget->myGeomApproxAngle->setValue( data.myApproxAngle ); - myStdWidget->myHexoticIgnoreRidges->setChecked( data.myHexoticIgnoreRidges ); - myStdWidget->myHexoticInvalidElements->setChecked( data.myHexoticInvalidElements ); - - myStdWidget->myHexoticSharpAngleThreshold->setCleared(data.myHexoticSharpAngleThreshold == 0); - if (data.myHexoticSharpAngleThreshold == 0) - myStdWidget->myHexoticSharpAngleThreshold->setText(""); - else - myStdWidget->myHexoticSharpAngleThreshold->setValue( data.myHexoticSharpAngleThreshold ); -#ifndef WIN32 - myStdWidget->myHexoticNbProc->setValue( data.myHexoticNbProc ); -#endif - myStdWidget->myHexoticWorkingDir->setText( data.myHexoticWorkingDir ); + myAdvWidget->myHexoticWorkingDir->setText( data.myHexoticWorkingDir ); - myStdWidget->myHexoticVerbosity->setValue( data.myHexoticVerbosity ); - - myStdWidget->myHexoticMaxMemory->setValue( data.myHexoticMaxMemory ); + myAdvWidget->myHexoticVerbosity->setValue( data.myHexoticVerbosity ); myStdWidget->myHexoticSdMode->setCurrentIndex(data.myHexoticSdMode); - - myStdWidget->myTextOptions->setText(data.myTextOptions); + + //myAdvWidget->SetCustomOptions(data.myTextOptions); + + if ( myOptions.operator->() ) { + for ( int i = 0, nb = myOptions->length(); i < nb; ++i ) + myAdvWidget->AddOption( myOptions[i].in() ); + } + if ( myCustomOptions.operator->() ) { + for ( int i = 0, nb = myCustomOptions->length(); i < nb; ++i ) + myAdvWidget->AddOption( myCustomOptions[i].in() ); + } + myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN ); + + myAdvWidget->keepWorkingFilesCheck->setChecked( data.myKeepFiles ); + myAdvWidget->logInFileCheck->setChecked( !data.myLogInStandardOutput ); + myAdvWidget->removeLogOnSuccessCheck->setChecked( data.myRemoveLogOnSuccess ); HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it = data.mySizeMaps.begin(); for ( int row = 0; it != data.mySizeMaps.end(); it++, row++ ) @@ -462,7 +481,7 @@ void HexoticPluginGUI_HypothesisCreator::retrieveParams() const GEOM::GEOM_Object_var anObject = entryToObject( entry ); std::string shapeName = anObject->GetName(); - MESSAGE(" Insert local size, entry : "< vector = data.myFacesWithLayers; SMESH::long_array_var aVec = new SMESH::long_array; aVec->length(vector.size()); - for (int i = 0; i < vector.size(); i++) + for (size_t i = 0; i < vector.size(); i++) aVec[i]=vector.at(i); myVLWidget->myFacesWithLayers->SetListOfIDs(aVec); vector = data.myImprintedFaces; aVec = new SMESH::long_array; aVec->length(vector.size()); - for (int i = 0; i < vector.size(); i++) + for (size_t i = 0; i < vector.size(); i++) aVec[i]=vector.at(i); myVLWidget->myImprintedFaces->SetListOfIDs(aVec); - - std::cout << "myStdWidget->myMinSize->value(): " << myStdWidget->myMinSize->value() << std::endl; - std::cout << "myStdWidget->myMaxSize->value(): " << myStdWidget->myMaxSize->value() << std::endl; - std::cout << "myStdWidget->myHexesMinLevel->value(): " << myStdWidget->myHexesMinLevel->value() << std::endl; - std::cout << "myStdWidget->myHexesMaxLevel->value(): " << myStdWidget->myHexesMaxLevel->value() << std::endl; - std::cout << "myStdWidget->myHexoticSharpAngleThreshold->value(): " << myStdWidget->myHexoticSharpAngleThreshold->value() << std::endl; - } void HexoticPluginGUI_HypothesisCreator::printData( HexoticHypothesisData& data) const @@ -567,6 +579,7 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromHypo( HexoticHypothesisDa h_data.myName = isCreation() && data ? data->Label : ""; h_data.myMinSize = h->GetMinSize(); h_data.myMaxSize = h->GetMaxSize(); + h_data.myApproxAngle = h->GetGeomApproxAngle(); h_data.myHexesMinLevel = h->GetHexesMinLevel(); h_data.myHexesMaxLevel = h->GetHexesMaxLevel(); h_data.myHexoticIgnoreRidges = h->GetHexoticIgnoreRidges(); @@ -577,17 +590,24 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromHypo( HexoticHypothesisDa h_data.myHexoticVerbosity = h->GetHexoticVerbosity(); h_data.myHexoticMaxMemory = h->GetHexoticMaxMemory(); h_data.myHexoticSdMode = h->GetHexoticSdMode()-1; - h_data.myTextOptions = h->GetTextOptions(); - + h_data.myKeepFiles = h->GetKeepFiles(); + h_data.myLogInStandardOutput = h->GetStandardOutputLog(); + h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess(); + //h_data.myTextOptions = h->GetAdvancedOption(); + + HexoticPluginGUI_HypothesisCreator* that = (HexoticPluginGUI_HypothesisCreator*)this; + that->myOptions = h->GetOptionValues(); + that->myCustomOptions = h->GetAdvancedOptionValues(); + // Size maps HexoticPlugin::HexoticPluginSizeMapsList_var sizeMaps = h->GetSizeMaps(); - for ( int i = 0 ; i < sizeMaps->length() ; i++) + for ( CORBA::ULong i = 0 ; i < sizeMaps->length() ; i++) { HexoticPlugin::HexoticPluginSizeMap aSizeMap = sizeMaps[i]; std::string entry = CORBA::string_dup(aSizeMap.entry.in()); double size = aSizeMap.size; h_data.mySizeMaps[ entry ] = size; - MESSAGE("READING Size map : entry "<GetDirection(); h_data.myGrowth = h->GetGrowth(); SMESH::long_array_var vector = h->GetFacesWithLayers(); - for (int i = 0; i < vector->length(); i++) + for ( CORBA::ULong i = 0; i < vector->length(); i++) h_data.myFacesWithLayers.push_back(vector[i]); vector = h->GetImprintedFaces(); - for (int i = 0; i < vector->length(); i++) + for ( CORBA::ULong i = 0; i < vector->length(); i++) h_data.myImprintedFaces.push_back(vector[i]); return true; @@ -619,24 +639,20 @@ bool HexoticPluginGUI_HypothesisCreator::storeParamsToHypo( const HexoticHypothe h->SetMinSize( h_data.myMinSize ); h->SetMaxSize( h_data.myMaxSize ); - h->SetHexesMinLevel( h_data.myHexesMinLevel ); - h->SetHexesMaxLevel( h_data.myHexesMaxLevel ); - h->SetHexoticIgnoreRidges( h_data.myHexoticIgnoreRidges ); - h->SetHexoticInvalidElements( h_data.myHexoticInvalidElements ); - h->SetHexoticSharpAngleThreshold( h_data.myHexoticSharpAngleThreshold ); - h->SetHexoticNbProc( h_data.myHexoticNbProc ); + h->SetGeomApproxAngle( h_data.myApproxAngle ); h->SetHexoticWorkingDirectory( h_data.myHexoticWorkingDir.toLatin1().constData() ); h->SetHexoticVerbosity( h_data.myHexoticVerbosity ); - h->SetHexoticMaxMemory( h_data.myHexoticMaxMemory ); h->SetHexoticSdMode( h_data.myHexoticSdMode+1 ); - h->SetTextOptions( h_data.myTextOptions.toLatin1().constData() ); + h->SetKeepFiles( h_data.myKeepFiles ); + h->SetStandardOutputLog( h_data.myLogInStandardOutput ); + h->SetRemoveLogOnSuccess( h_data.myRemoveLogOnSuccess ); HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it; for ( it = h_data.mySizeMaps.begin(); it != h_data.mySizeMaps.end(); it++ ) { h->SetSizeMapEntry( it->first.c_str(), it->second ); - MESSAGE("STORING Size map : entry "<first.c_str()<<" size : "<second) + MESSAGE("STORING Size map : entry "<first.c_str()<<" size : "<second); } std::vector< std::string >::const_iterator entry_it; for ( entry_it = mySizeMapsToRemove.begin(); entry_it!= mySizeMapsToRemove.end(); entry_it++ ) @@ -653,14 +669,14 @@ bool HexoticPluginGUI_HypothesisCreator::storeParamsToHypo( const HexoticHypothe std::vector vector = h_data.myFacesWithLayers; SMESH::long_array_var aVec = new SMESH::long_array; aVec->length(vector.size()); - for (int i = 0; i < vector.size(); i++) + for ( size_t i = 0; i < vector.size(); i++) aVec[i]=vector.at(i); h->SetFacesWithLayers( aVec ); vector = h_data.myImprintedFaces; aVec = new SMESH::long_array; aVec->length(vector.size()); - for (int i = 0; i < vector.size(); i++) + for ( size_t i = 0; i < vector.size(); i++) aVec[i]=vector.at(i); h->SetImprintedFaces( aVec ); } @@ -676,22 +692,16 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromWidgets( HexoticHypothesi { h_data.myName = myName ? myName->text() : ""; - h_data.myHexoticIgnoreRidges = myStdWidget->myHexoticIgnoreRidges->isChecked(); - h_data.myHexoticInvalidElements = myStdWidget->myHexoticInvalidElements->isChecked(); -#ifndef WIN32 - h_data.myHexoticNbProc = myStdWidget->myHexoticNbProc->value(); -#endif - h_data.myHexoticWorkingDir = myStdWidget->myHexoticWorkingDir->text(); - h_data.myHexoticVerbosity = myStdWidget->myHexoticVerbosity->value(); - h_data.myHexoticMaxMemory = myStdWidget->myHexoticMaxMemory->value(); - h_data.myHexoticSdMode = myStdWidget->myHexoticSdMode->currentIndex(); - h_data.myTextOptions = myStdWidget->myTextOptions->text(); - h_data.myMinSize = myStdWidget->myMinSize->text().isEmpty() ? 0.0 : myStdWidget->myMinSize->value(); h_data.myMaxSize = myStdWidget->myMaxSize->text().isEmpty() ? 0.0 : myStdWidget->myMaxSize->value(); - h_data.myHexesMinLevel = myStdWidget->myHexesMinLevel->text().isEmpty() ? 0 : myStdWidget->myHexesMinLevel->value(); - h_data.myHexesMaxLevel = myStdWidget->myHexesMaxLevel->text().isEmpty() ? 0 : myStdWidget->myHexesMaxLevel->value(); - h_data.myHexoticSharpAngleThreshold = myStdWidget->myHexoticSharpAngleThreshold->text().isEmpty() ? 0 : myStdWidget->myHexoticSharpAngleThreshold->value(); + h_data.myApproxAngle = myStdWidget->myGeomApproxAngle->text().isEmpty() ? 0.0 : myStdWidget->myGeomApproxAngle->value(); + h_data.myHexoticSdMode = myStdWidget->myHexoticSdMode->currentIndex(); + + h_data.myHexoticWorkingDir = myAdvWidget->myHexoticWorkingDir->text(); + h_data.myHexoticVerbosity = myAdvWidget->myHexoticVerbosity->value(); + h_data.myKeepFiles = myAdvWidget->keepWorkingFilesCheck->isChecked(); + h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked(); + h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked(); // Size maps reading bool ok = readSizeMapsFromWidgets( h_data ); @@ -703,10 +713,10 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromWidgets( HexoticHypothesi h_data.myDirection = myVLWidget->myDirection->currentIndex() == 0 ? true : false; h_data.myGrowth = myVLWidget->myGrowth->text().isEmpty() ? 0.0 : myVLWidget->myGrowth->value(); SMESH::long_array_var ids = myVLWidget->myFacesWithLayers->GetListOfIDs(); - for (int i = 0; i < ids->length(); i++) + for ( CORBA::ULong i = 0; i < ids->length(); i++) h_data.myFacesWithLayers.push_back( ids[i] ); ids = myVLWidget->myImprintedFaces->GetListOfIDs(); - for (int i = 0; i < ids->length(); i++) + for ( CORBA::ULong i = 0; i < ids->length(); i++) h_data.myImprintedFaces.push_back( ids[i] ); printData(h_data); @@ -730,17 +740,15 @@ bool HexoticPluginGUI_HypothesisCreator::readSizeMapsFromWidgets( HexoticHypothe // Set the size maps h_data.mySizeMaps[ entry ] = size; - MESSAGE("READING Size map from WIDGET: entry "<GetCurrentStudy(); GEOM::GEOM_Object_var aGeomObj; - SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() ); + SALOMEDS::SObject_var aSObj = SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindObjectID( entry.c_str() ); if (!aSObj->_is_nil()) { CORBA::Object_var obj = aSObj->GetObject(); aGeomObj = GEOM::GEOM_Object::_narrow(obj); @@ -775,3 +783,15 @@ void HexoticPluginGUI_HypothesisCreator::onTabChanged(int i) myVLWidget->myFacesWithLayers->ShowPreview( i == VL_TAB ); myVLWidget->myImprintedFaces->ShowPreview( false ); } + +void HexoticPluginGUI_HypothesisCreator::onAddOption() +{ + myAdvWidget->AddOption( NULL, true ); +} + +void HexoticPluginGUI_HypothesisCreator::onDirBtnClicked() +{ + QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myAdvWidget->myHexoticWorkingDir->text(), QString() ); + if ( !dir.isEmpty() ) + myAdvWidget->myHexoticWorkingDir->setText( dir ); +}