From: eap Date: Thu, 13 Jun 2019 15:49:10 +0000 (+0300) Subject: #16954 EDF 19466 - localsize X-Git-Tag: V9_4_0a1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bba1aad613e9568fecb4c2febe7553c6edeee715;p=plugins%2Fblsurfplugin.git #16954 EDF 19466 - localsize Limit local size by Min and User Size --- diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index 4ff245c..196fcc1 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -564,12 +564,6 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const } } } - if ( !ok ) - { - h->SetOptionValues( myOptions ); // restore values - h->SetPreCADOptionValues( myPreCADOptions ); // restore values - return ok; - } // SizeMap and attractors if ( ok ) @@ -590,7 +584,7 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const try { e = entry.toStdString(); s = that->mySMPMap[entry].toStdString(); - h->SetSizeMapEntry( e.c_str(), s.c_str() ); + //h->SetSizeMapEntry( e.c_str(), s.c_str() ); } catch ( const SALOME::SALOME_Exception& ex ) { @@ -637,9 +631,61 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_CHORDAL_ERROR")); } + // #16954 EDF 19466 - localsize + // Warn the user if local size is less than Min Size + if ( ok && + !myStdWidget->myMinSizeRel->isChecked() && + !myStdWidget->myMinSize->text().isEmpty() ) + { + const double minSize = myStdWidget->myMinSize->GetValue(); + bool isValue; + for ( QMapIterator i( mySMPMap ); i.hasNext() && ok ; ) + { + i.next(); + double size = i.value().toDouble( &isValue ); + ok = ( !isValue || size >= minSize ); + } + for ( QMapIterator i( myATTMap ); i.hasNext() && ok ; i.next() ) + { + const TAttractorVec& attVec = i.value(); + for ( size_t i = 0; i < attVec.size(); ++i ) + ok = ( attVec[i].IsToDelete() || attVec[i].startSize >= minSize ); + } + if ( !ok ) + msg = tr( "TOO_SMALL_LOCAL_SIZE" ); + } + // Warn the user if local size is more than User Size + if ( ok && + !myStdWidget->myPhySizeRel->isChecked() && + !myStdWidget->myPhySize->text().isEmpty() ) + { + const double userSize = myStdWidget->myPhySize->GetValue(); + bool isValue; + for ( QMapIterator i( mySMPMap ); i.hasNext() && ok ; ) + { + i.next(); + double size = i.value().toDouble( &isValue ); + ok = ( !isValue || size <= userSize ); + } + for ( QMapIterator i( myATTMap ); i.hasNext() && ok ; i.next() ) + { + const TAttractorVec& attVec = i.value(); + for ( size_t i = 0; i < attVec.size(); ++i ) + ok = ( attVec[i].IsToDelete() || attVec[i].startSize <= userSize ); + } + if ( !ok ) + msg = tr( "TOO_LARGE_LOCAL_SIZE" ); + } + // Enforced vertices // TODO + if ( !ok ) + { + h->SetOptionValues( myOptions ); // restore values + h->SetPreCADOptionValues( myPreCADOptions ); // restore values + } + return ok; } @@ -2760,7 +2806,6 @@ void BLSURFPluginGUI_HypothesisCreator::onTabChanged(int tab) myHyPatchFaceSelBtn->toggle(); if ( myHyPatchGroupSelBtn->isChecked() ) myHyPatchGroupSelBtn->toggle(); - return; } else if ( sender() == smpTab ) { @@ -2777,6 +2822,22 @@ void BLSURFPluginGUI_HypothesisCreator::onTabChanged(int tab) myAttractorCheck->setChecked(false); myConstSizeCheck->setChecked(false); } + + if ( tab == SMP_TAB ) // [#16954] limit local size by Min and User Size + { + double minSize = 0, maxSize = COORD_MAX; + + if ( !myStdWidget->myMinSizeRel->isChecked() && + !myStdWidget->myMinSize->text().isEmpty() ) + minSize = myStdWidget->myMinSize->GetValue(); + + if ( !myStdWidget->myPhySizeRel->isChecked() && + !myStdWidget->myPhySize->text().isEmpty() ) + maxSize = myStdWidget->myPhySize->GetValue(); + + mySmpSizeSpin->RangeStepAndValidator(minSize, maxSize, 1.0, "length_precision"); + myAttSizeSpin->RangeStepAndValidator(minSize, maxSize, 1.0, "length_precision"); + } } void BLSURFPluginGUI_HypothesisCreator::onAttractorClicked(int state) diff --git a/src/GUI/BLSURFPlugin_msg_en.ts b/src/GUI/BLSURFPlugin_msg_en.ts index 8117f43..41a84a8 100644 --- a/src/GUI/BLSURFPlugin_msg_en.ts +++ b/src/GUI/BLSURFPlugin_msg_en.ts @@ -502,6 +502,14 @@ The smaller this distance is, the closer the mesh is to the exact surface (only ZERO_VALUE_OF Invalid value (zero) of "%1" + + TOO_SMALL_LOCAL_SIZE + Local size should be more than Min Size + + + TOO_LARGE_LOCAL_SIZE + Local size should be less than User Size + BLSURF_PERIODICITY Periodicity