Salome HOME
Merge branch 'occ/shaper2smesh'
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_StdHypothesisCreator.cxx
index e912e113d1d337b55483d397ac80483c2b4aff4a..8dc3f134922ea00e7882f0219d7062fb6b79342b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #include <SMESHGUI_HypothesesUtils.h>
 #include <SMESHGUI_Utils.h>
 #include <SMESHGUI_GEOMGenUtils.h>
-
 #include <SMESH_TypeFilter.hxx>
 #include <SMESH_NumberFilter.hxx>
 
 #include "StdMeshersGUI_FixedPointsParamWdg.h"
 #include "StdMeshersGUI_LayerDistributionParamWdg.h"
 #include "StdMeshersGUI_ObjectReferenceParamWdg.h"
+#include "StdMeshersGUI_PropagationHelperWdg.h"
 #include "StdMeshersGUI_QuadrangleParamWdg.h"
-#include "StdMeshersGUI_SubShapeSelectorWdg.h"
 #include "StdMeshersGUI_RadioButtonsGrpWdg.h"
+#include "StdMeshersGUI_NameCheckableGrpWdg.h"
+#include "StdMeshersGUI_SubShapeSelectorWdg.h"
 
 #include <SALOMEDSClient_Study.hxx>
 
 #include <GEOM_wrap.hxx>
 
 // SALOME GUI includes
-#include <SUIT_ResourceMgr.h>
 #include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_IntSpinBox.h>
 
 // IDL includes
 #include <SALOMEconfig.h>
@@ -77,7 +79,7 @@ const double VALUE_MAX = 1.0e+15, // COORD_MAX
 //================================================================================
 
 StdMeshersGUI_StdHypothesisCreator::StdMeshersGUI_StdHypothesisCreator( const QString& type )
-: SMESHGUI_GenericHypothesisCreator( type )
+  : SMESHGUI_GenericHypothesisCreator( type ), myHelperWidget( 0 )
 {
 }
 
@@ -125,7 +127,7 @@ QWidget* StdMeshersGUI_StdHypothesisCreator::getWidgetForParam( int i ) const
 
 //================================================================================
 /*!
- * \brief Allow modifing myCustomWidgets in const methods
+ * \brief Allow modifying myCustomWidgets in const methods
   * \retval ListOfWidgets* - non-const pointer to myCustomWidgets
  */
 //================================================================================
@@ -376,10 +378,51 @@ namespace {
   }
 }
 
+//================================================================================
+/*!
+ * \brief Remove a group, whose name is stored by hypothesis, upon group name modification
+ *  \param [in] oldName - old group name
+ *  \param [in] newName - new group name
+ *  \param [in] type - group type
+ */
+//================================================================================
+
+void StdMeshersGUI_StdHypothesisCreator::
+removeOldGroup(const char* oldName, const char* newName, SMESH::ElementType type) const
+{
+  if ( !oldName || !oldName[0] )
+    return; // old name undefined
+  if ( newName && strcmp( oldName, newName ) == 0 )
+    return; // same name
+
+  SMESH::SMESH_Hypothesis_var h = hypothesis();
+  SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( h );
+  for ( size_t i = 0; i < listSOmesh.size(); i++ )
+  {
+    _PTR(SObject) submSO = listSOmesh[i];
+    SMESH::SMESH_Mesh_var       mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
+    SMESH::SMESH_subMesh_var subMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
+    if( !subMesh->_is_nil() )
+      mesh = subMesh->GetFather();
+    if ( mesh->_is_nil() )
+      continue;
+    SMESH::ListOfGroups_var groups = mesh->GetGroups();
+    for ( CORBA::ULong iG = 0; iG < groups->length(); iG++ )
+    {
+      if ( groups[iG]->GetType() != type )
+        continue;
+      CORBA::String_var name = groups[iG]->GetName();
+      if ( strcmp( name.in(), oldName ))
+        continue;
+      mesh->RemoveGroup( groups[iG] );
+    }
+  }
+}
+
 //================================================================================
 /*!
  * \brief Check parameter values before accept()
 * \retval bool - true if OK
 \retval bool - true if OK
  */
 //================================================================================
 
@@ -421,11 +464,11 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
       // then the FACE must have only one VERTEX
       GEOM::GEOM_Object_var face = w->GetObject< GEOM::GEOM_Object >();
 
-      GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
-      _PTR(Study)         aStudy = SMESH::GetActiveStudyDocument();
+      GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( face );
+      _PTR(Study)         aStudy = SMESH::getStudy();
       GEOM::GEOM_IShapesOperations_wrap shapeOp;
       if ( !geomGen->_is_nil() && aStudy )
-        shapeOp = geomGen->GetIShapesOperations( aStudy->StudyId() );
+        shapeOp = geomGen->GetIShapesOperations();
       if ( !shapeOp->_is_nil() )
       {
         GEOM::ListOfLong_var vertices =
@@ -466,7 +509,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
   bool res = getStdParamFromDlg( params );
   if( isCreation() )
   {
-    SMESH::SetName( SMESH::FindSObject( hypothesis() ), params[0].myValue.toString().toLatin1().data() );
+    SMESH::SetName( SMESH::FindSObject( hypothesis() ), params[0].myValue.toString().toUtf8().data() );
     params.erase( params.begin() );
   }
 
@@ -714,17 +757,27 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
       StdMeshers::StdMeshers_ViscousLayers_var h =
         StdMeshers::StdMeshers_ViscousLayers::_narrow( hypothesis() );
 
-      h->SetVarParameter( params[0].text(), "SetTotalThickness" );
+      h->SetVarParameter  ( params[0].text(), "SetTotalThickness" );
       h->SetTotalThickness( params[0].myValue.toDouble() );
-      h->SetVarParameter( params[1].text(), "SetNumberLayers" );
+      h->SetVarParameter  ( params[1].text(), "SetNumberLayers" );
       h->SetNumberLayers  ( params[1].myValue.toInt() );
-      h->SetVarParameter( params[2].text(), "SetStretchFactor" );
+      h->SetVarParameter  ( params[2].text(), "SetStretchFactor" );
       h->SetStretchFactor ( params[2].myValue.toDouble() );
+      h->SetMethod (( StdMeshers::VLExtrusionMethod ) params[3].myValue.toInt() );
 
-      if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = 
-           widget< StdMeshersGUI_SubShapeSelectorWdg >( 4 ))
+      if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg =
+           widget< StdMeshersGUI_SubShapeSelectorWdg >( 5 ))
+      {
+        h->SetFaces( idsWg->GetListOfIDs(), params[4].myValue.toInt() );
+      }
+
+      if ( StdMeshersGUI_NameCheckableGrpWdg* nameWg =
+           widget< StdMeshersGUI_NameCheckableGrpWdg >( 6 ))
       {
-        h->SetFaces( idsWg->GetListOfIDs(), params[3].myValue.toInt() );
+        CORBA::String_var oldName = h->GetGroupName();
+        h->SetGroupName( nameWg->getName().toUtf8().data() );
+        CORBA::String_var newName = h->GetGroupName();
+        removeOldGroup( oldName, newName, SMESH::VOLUME );
       }
     }
     else if( hypType()=="ViscousLayers2D" )
@@ -732,11 +785,11 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
       StdMeshers::StdMeshers_ViscousLayers2D_var h =
         StdMeshers::StdMeshers_ViscousLayers2D::_narrow( hypothesis() );
 
-      h->SetVarParameter( params[0].text(), "SetTotalThickness" );
+      h->SetVarParameter  ( params[0].text(), "SetTotalThickness" );
       h->SetTotalThickness( params[0].myValue.toDouble() );
-      h->SetVarParameter( params[1].text(), "SetNumberLayers" );
+      h->SetVarParameter  ( params[1].text(), "SetNumberLayers" );
       h->SetNumberLayers  ( params[1].myValue.toInt() );
-      h->SetVarParameter( params[2].text(), "SetStretchFactor" );
+      h->SetVarParameter  ( params[2].text(), "SetStretchFactor" );
       h->SetStretchFactor ( params[2].myValue.toDouble() );
 
       if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg =
@@ -744,6 +797,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
       {
         h->SetEdges( idsWg->GetListOfIDs(), params[3].myValue.toInt() );
       }
+
+      if ( StdMeshersGUI_NameCheckableGrpWdg* nameWg =
+           widget< StdMeshersGUI_NameCheckableGrpWdg >( 5 ))
+      {
+        CORBA::String_var oldName = h->GetGroupName();
+        h->SetGroupName( nameWg->getName().toUtf8().data() );
+        CORBA::String_var newName = h->GetGroupName();
+        removeOldGroup( oldName, newName, SMESH::FACE );
+      }
     }
     // else if( hypType()=="QuadrangleParams" )
     // {
@@ -839,7 +901,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     item.myName = tr("SMESH_USE_PREESTIMATED_LENGTH");
     p.append( item );
     QCheckBox* aQCheckBox = new QCheckBox(dlg());
-    if ( !noPreestimatedAtEdition && h->HavePreestimatedLength() ) {
+    if ( h->HavePreestimatedLength() ) {
       aQCheckBox->setChecked( h->GetUsePreestimatedLength() );
       connect( aQCheckBox, SIGNAL(  stateChanged(int) ), this, SLOT( onValueChanged() ) );
     }
@@ -882,18 +944,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     item.myName = tr( "SMESH_REVERSED_EDGES" );
     p.append( item );
 
-    StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
-      new StdMeshersGUI_SubShapeSelectorWdg();
-    QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
-    QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
-    if ( aGeomEntry == "" )
-      aGeomEntry = h->GetObjectEntry();
-
-    aDirectionWidget->SetGeomShapeEntry( aGeomEntry );
-    aDirectionWidget->SetMainShapeEntry( aMainEntry );
-    aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
-    aDirectionWidget->showPreview( true );
-    customWidgets()->append ( aDirectionWidget );
+    customWidgets()->append ( makeReverseEdgesWdg( h->GetReversedEdges(), h->GetObjectEntry() ));
   }
 
   else if( hypType()=="GeometricProgression" )
@@ -918,18 +969,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     item.myName = tr( "SMESH_REVERSED_EDGES" );
     p.append( item );
 
-    StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
-      new StdMeshersGUI_SubShapeSelectorWdg();
-    QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
-    QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
-    if ( aGeomEntry == "" )
-      aGeomEntry = h->GetObjectEntry();
-
-    aDirectionWidget->SetGeomShapeEntry( aGeomEntry );
-    aDirectionWidget->SetMainShapeEntry( aMainEntry );
-    aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
-    aDirectionWidget->showPreview( true );
-    customWidgets()->append ( aDirectionWidget );
+    customWidgets()->append ( makeReverseEdgesWdg( h->GetReversedEdges(), h->GetObjectEntry() ));
   }
 
   else if( hypType()=="FixedPoints1D" )
@@ -952,17 +992,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     item.myName = tr( "SMESH_REVERSED_EDGES" );
     p.append( item );
 
-    StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
-      new StdMeshersGUI_SubShapeSelectorWdg();
-    QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
-    QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
-    if ( anEntry == "" )
-      anEntry = h->GetObjectEntry();
-    aDirectionWidget->SetGeomShapeEntry( anEntry );
-    aDirectionWidget->SetMainShapeEntry( aMainEntry );
-    aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
-    aDirectionWidget->showPreview( true );
-    customWidgets()->append ( aDirectionWidget );
+    customWidgets()->append ( makeReverseEdgesWdg( h->GetReversedEdges(), h->GetObjectEntry() ));
   }
 
 
@@ -975,7 +1005,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     if(!initVariableName( hyp, item, "SetMaxElementArea" ))
       item.myValue = h->GetMaxElementArea();
     p.append( item );
-    
+
   }
   else if( hypType()=="MaxElementVolume" )
   {
@@ -994,13 +1024,13 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
 
     item.myName = tr( "SMESH_START_LENGTH_PARAM" );
 
-    if(!initVariableName( hyp, item, "SetStartLength" )) 
+    if(!initVariableName( hyp, item, "SetStartLength" ))
       item.myValue = h->GetLength( true );
     p.append( item );
     customWidgets()->append(0);
 
     item.myName = tr( "SMESH_END_LENGTH_PARAM" );
-    if(!initVariableName( hyp, item, "SetEndLength" )) 
+    if(!initVariableName( hyp, item, "SetEndLength" ))
       item.myValue = h->GetLength( false );
     p.append( item );
     customWidgets()->append(0);
@@ -1008,17 +1038,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     item.myName = tr( "SMESH_REVERSED_EDGES" );
     p.append( item );
 
-    StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
-      new StdMeshersGUI_SubShapeSelectorWdg();
-    QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
-    QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
-    if ( anEntry == "" )
-      anEntry = h->GetObjectEntry();
-    aDirectionWidget->SetGeomShapeEntry( anEntry );
-    aDirectionWidget->SetMainShapeEntry( aMainEntry );
-    aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
-    aDirectionWidget->showPreview( true );
-    customWidgets()->append ( aDirectionWidget );
+    customWidgets()->append ( makeReverseEdgesWdg( h->GetReversedEdges(), h->GetObjectEntry() ));
   }
   else if( hypType()=="Deflection1D" )
   {
@@ -1026,7 +1046,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
       StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
 
     item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
-    if(!initVariableName( hyp, item, "SetDeflection" )) 
+    if(!initVariableName( hyp, item, "SetDeflection" ))
       item.myValue = h->GetDeflection();
     p.append( item );
   }
@@ -1036,17 +1056,17 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
       StdMeshers::StdMeshers_Adaptive1D::_narrow( hyp );
 
     item.myName = tr( "SMESH_MIN_SIZE" );
-    if(!initVariableName( hyp, item, "SetMinSize" )) 
+    if(!initVariableName( hyp, item, "SetMinSize" ))
       item.myValue = h->GetMinSize();
     p.append( item );
 
     item.myName = tr( "SMESH_MAX_SIZE" );
-    if(!initVariableName( hyp, item, "SetMaxSize" )) 
+    if(!initVariableName( hyp, item, "SetMaxSize" ))
       item.myValue = h->GetMaxSize();
     p.append( item );
 
     item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
-    if(!initVariableName( hyp, item, "SetDeflection" )) 
+    if(!initVariableName( hyp, item, "SetDeflection" ))
       item.myValue = h->GetDeflection();
     p.append( item );
   }
@@ -1242,6 +1262,20 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     p.append( item );
     customWidgets()->append (0);
 
+    item.myName = tr( "EXTRUSION_METHOD" );
+    p.append( item );
+    StdMeshersGUI_RadioButtonsGrpWdg* methodWdg = new StdMeshersGUI_RadioButtonsGrpWdg("");
+    methodWdg->setButtonLabels ( QStringList()
+                                 << tr("EXTMETH_SURF_OFFSET_SMOOTH")
+                                 << tr("EXTMETH_FACE_OFFSET")
+                                 << tr("EXTMETH_NODE_OFFSET"),
+                                 QStringList()
+                                 << tr("ICON_EXTMETH_SURF_OFFSET_SMOOTH")
+                                 << tr("ICON_EXTMETH_FACE_OFFSET")
+                                 << tr("ICON_EXTMETH_NODE_OFFSET"));
+    methodWdg->setChecked( (int) h->GetMethod() );
+    customWidgets()->append( methodWdg );
+
     QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
     QString aSubEntry  = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
     if ( !aMainEntry.isEmpty() )
@@ -1264,11 +1298,10 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
       StdMeshersGUI_SubShapeSelectorWdg* idsWg =
         new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_FACE);
 
-      idsWg->SetMainShapeEntry( aMainEntry );
-      idsWg->SetGeomShapeEntry( aSubEntry.isEmpty() ? aMainEntry : aSubEntry );
+      idsWg->SetGeomShapeEntry( aSubEntry, aMainEntry );
       if ( idsWg->SetListOfIDs( h->GetFaces() ))
       {
-        idsWg->showPreview( true );
+        idsWg->ShowPreview( true );
       }
       else
       {
@@ -1277,6 +1310,19 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
       }
       customWidgets()->append ( idsWg );
     }
+
+    item.setNoName();
+    p.append( item );
+    StdMeshersGUI_NameCheckableGrpWdg* nameWdg =
+      new StdMeshersGUI_NameCheckableGrpWdg( tr( "CREATE_GROUPS_FROM_LAYERS" ),
+                                             tr( "GROUP_NAME" ));
+    nameWdg->setName( h->GetGroupName() );
+    if ( nameWdg->getName().isEmpty() )
+    {
+      nameWdg->setDefaultName( type() );
+      nameWdg->setChecked( false );
+    }
+    customWidgets()->append ( nameWdg );
   }
   else if( hypType()=="ViscousLayers2D" )
   {
@@ -1323,11 +1369,10 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
       StdMeshersGUI_SubShapeSelectorWdg* idsWg =
         new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_EDGE);
 
-      idsWg->SetMainShapeEntry( aMainEntry );
-      idsWg->SetGeomShapeEntry( aSubEntry.isEmpty() ? aMainEntry : aSubEntry );
+      idsWg->SetGeomShapeEntry( aSubEntry, aMainEntry );
       if ( idsWg->SetListOfIDs( h->GetEdges() ))
       {
-        idsWg->showPreview( true );
+        idsWg->ShowPreview( true );
       }
       else
       {
@@ -1336,47 +1381,20 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
       }
       customWidgets()->append ( idsWg );
     }
+
+    item.setNoName();
+    p.append( item );
+    StdMeshersGUI_NameCheckableGrpWdg* nameWdg =
+      new StdMeshersGUI_NameCheckableGrpWdg( tr( "CREATE_GROUPS_FROM_LAYERS" ),
+                                             tr( "GROUP_NAME" ));
+    nameWdg->setName( h->GetGroupName() );
+    if ( nameWdg->getName().isEmpty() )
+    {
+      nameWdg->setDefaultName( type() );
+      nameWdg->setChecked( false );
+    }
+    customWidgets()->append ( nameWdg );
   }
-  // else if (hypType() == "QuadrangleParams")
-  // {
-  //   StdMeshers::StdMeshers_QuadrangleParams_var h =
-  //     StdMeshers::StdMeshers_QuadrangleParams::_narrow(hyp);
-
-  //   item.myName = tr("SMESH_BASE_VERTEX");
-  //   p.append(item);
-
-  //   StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
-  //     new StdMeshersGUI_SubShapeSelectorWdg(0, TopAbs_VERTEX);
-  //   aDirectionWidget->SetMaxSize(1);
-  //   QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
-  //   QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
-  //   if (anEntry == "")
-  //     anEntry = h->GetObjectEntry();
-  //   aDirectionWidget->SetGeomShapeEntry(anEntry);
-  //   aDirectionWidget->SetMainShapeEntry(aMainEntry);
-  //   if (!isCreation()) {
-  //     SMESH::long_array_var aVec = new SMESH::long_array;
-  //     int vertID = h->GetTriaVertex();
-  //     if (vertID > 0) {
-  //       aVec->length(1);
-  //       aVec[0] = vertID;
-  //       aDirectionWidget->SetListOfIDs(aVec);
-  //     }
-  //   }
-  //   aDirectionWidget->showPreview(true);
-
-  //   item.myName = tr("SMESH_QUAD_TYPE");
-  //   p.append(item);
-
-  //   StdMeshersGUI_QuadrangleParamWdg* aTypeWidget =
-  //     new StdMeshersGUI_QuadrangleParamWdg();
-  //   if (!isCreation()) {
-  //     aTypeWidget->SetType(int(h->GetQuadType()));
-  //   }
-
-  //   customWidgets()->append(aDirectionWidget);
-  //   customWidgets()->append(aTypeWidget);
-  // }
   else
     res = false;
   return res;
@@ -1417,6 +1435,7 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int)
     {
       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
       sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
+      sb->setMinimumWidth( 150 );
     }
     else if( hypType()=="MaxElementArea" )
     {
@@ -1450,6 +1469,14 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int)
       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
     }
   }
+  else if ( SalomeApp_IntSpinBox* sb = qobject_cast< SalomeApp_IntSpinBox* >( w ))
+  {
+    if ( hypType().startsWith( "NumberOfLayers" ) ||
+         hypType().startsWith( "ViscousLayers" ))
+    {
+      sb->setMinimum( 1 );
+    }
+  }
 }
 
 //================================================================================
@@ -1492,7 +1519,7 @@ QString StdMeshersGUI_StdHypothesisCreator::type() const
 //================================================================================
 /*!
  * \brief String to insert in "SMESH_%1_HYPOTHESIS" to get hypothesis type name
- * from message resouce file
+ * from message resource file
   * \param t - hypothesis type
   * \retval QString - result string
  */
@@ -1633,6 +1660,10 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa
     param.myValue = w->checkedId();
     return true;
   }
+  if ( widget->inherits( "StdMeshersGUI_NameCheckableGrpWdg" ))
+  {
+    return true;
+  }
   return false;
 }
 
@@ -1685,9 +1716,10 @@ void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget)
   }
   else if ( hypType().startsWith( "ViscousLayers" ) && paramWidget->inherits("QButtonGroup"))
   {
-    if ( QLabel* label = getLabel(4) )
+    int widgetNumber = hypType() == "ViscousLayers2D" ? 3 : 4;
+    if ( QLabel* label = getLabel( widgetNumber + 1 ) )
     {
-      bool toIgnore = widget< StdMeshersGUI_RadioButtonsGrpWdg >( 3 )->checkedId();
+      bool toIgnore = widget< StdMeshersGUI_RadioButtonsGrpWdg >( widgetNumber )->checkedId();
       if ( hypType() == "ViscousLayers2D" )
         label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" ));
       else
@@ -1713,3 +1745,34 @@ bool StdMeshersGUI_StdHypothesisCreator::initVariableName(SMESH::SMESH_Hypothesi
 
   return theParams.isVariable;
 }
+
+//================================================================================
+/*!
+ * \brief Creates two widgets used to define reversed edges for some 1D hypotheses
+ *  \param [in] edgeIDs - ids of reversed edges to set to the widgets
+ *  \param [in] shapeEntry - entry of a sub-shape of a sub-mesh if any
+ *  \return QWidget* - new StdMeshersGUI_SubShapeSelectorWdg; 
+ *          new StdMeshersGUI_PropagationHelperWdg is stored in \a myHelperWidget field.
+ */
+//================================================================================
+
+QWidget*
+StdMeshersGUI_StdHypothesisCreator::makeReverseEdgesWdg( SMESH::long_array_var edgeIDs,
+                                                         CORBA::String_var     shapeEntry) const
+{
+  QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+  QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+  if ( aGeomEntry.isEmpty() && shapeEntry.in() )
+    aGeomEntry = shapeEntry.in();
+
+  StdMeshersGUI_SubShapeSelectorWdg* wdg = new StdMeshersGUI_SubShapeSelectorWdg();
+  wdg->SetGeomShapeEntry( aGeomEntry, aMainEntry );
+  wdg->SetListOfIDs( edgeIDs );
+  wdg->ShowPreview( true );
+
+  if ( !aGeomEntry.isEmpty() || !aMainEntry.isEmpty() )
+    const_cast<StdMeshersGUI_StdHypothesisCreator*>( this )->
+      myHelperWidget = new StdMeshersGUI_PropagationHelperWdg( wdg );
+
+  return wdg;
+}