Salome HOME
Copyrights update 2015.
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_StdHypothesisCreator.cxx
index 904f0bbd73e2a63deeb85b9d5444a1dda4d51e9d..a3b94c0a6ef532bd5d96d1d93ceae5ffefb12fc5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  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
@@ -47,6 +47,7 @@
 
 // SALOME GUI includes
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_MessageBox.h>
 
 // IDL includes
 #include <SALOMEconfig.h>
@@ -407,7 +408,7 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
       srcV = w1->GetValue();
       tgtV = w2->GetValue();
       ok = (( srcV.isEmpty()  && tgtV.isEmpty() ) ||
-            ( !srcV.isEmpty() && !tgtV.isEmpty() && srcV != tgtV ));
+            ( !srcV.isEmpty() && !tgtV.isEmpty() /*&& srcV != tgtV*/ ));
       if ( !ok ) {
         w1->SetObject( CORBA::Object::_nil() );
         w2->SetObject( CORBA::Object::_nil() );
@@ -609,8 +610,6 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
       h->SetMaxSize( params[1].myValue.toDouble() );
       h->SetVarParameter( params[0].text(), "SetDeflection" );
       h->SetDeflection( params[2].myValue.toDouble() );
-      h->SetVarParameter( params[0].text(), "SetGrading" );
-      h->SetGrading( params[3].myValue.toDouble() );
     }
     else if( hypType()=="AutomaticLength" )
     {
@@ -715,17 +714,18 @@ 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[3].myValue.toInt() );
+        h->SetFaces( idsWg->GetListOfIDs(), params[4].myValue.toInt() );
       }
     }
     else if( hypType()=="ViscousLayers2D" )
@@ -733,11 +733,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 =
@@ -1050,11 +1050,6 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     if(!initVariableName( hyp, item, "SetDeflection" )) 
       item.myValue = h->GetDeflection();
     p.append( item );
-
-    item.myName = tr( "SMESH_GRADING1D_PARAM" );
-    if(!initVariableName( hyp, item, "SetGrading" ))
-      item.myValue = h->GetGrading();
-    p.append( item );
   }
   else if( hypType()=="AutomaticLength" )
   {
@@ -1248,6 +1243,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() )
@@ -1272,8 +1281,15 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
 
       idsWg->SetMainShapeEntry( aMainEntry );
       idsWg->SetGeomShapeEntry( aSubEntry.isEmpty() ? aMainEntry : aSubEntry );
-      idsWg->SetListOfIDs( h->GetFaces() );
-      idsWg->showPreview( true );
+      if ( idsWg->SetListOfIDs( h->GetFaces() ))
+      {
+        idsWg->showPreview( true );
+      }
+      else
+      {
+        SUIT_MessageBox::warning( dlg(),tr( "SMESH_WRN_WARNING" ),tr( "BAD_FACES_WARNING" ));
+        idsWg->setEnabled( false );
+      }
       customWidgets()->append ( idsWg );
     }
   }
@@ -1324,8 +1340,15 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
 
       idsWg->SetMainShapeEntry( aMainEntry );
       idsWg->SetGeomShapeEntry( aSubEntry.isEmpty() ? aMainEntry : aSubEntry );
-      idsWg->SetListOfIDs( h->GetEdges() );
-      idsWg->showPreview( true );
+      if ( idsWg->SetListOfIDs( h->GetEdges() ))
+      {
+        idsWg->showPreview( true );
+      }
+      else
+      {
+        SUIT_MessageBox::warning( dlg(),tr( "SMESH_WRN_WARNING" ),tr( "BAD_EDGES_WARNING" ));
+        idsWg->setEnabled( false );
+      }
       customWidgets()->append ( idsWg );
     }
   }
@@ -1428,10 +1451,7 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int)
     }
     else if( hypType()=="Adaptive1D" )
     {
-      if (sb->objectName() == tr("SMESH_GRADING1D_PARAM"))
-        sb->RangeStepAndValidator( 0.0, 2.0, 0.1, "length_precision" );
-      else
-        sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
+      sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
     }
     else if( hypType().startsWith( "ViscousLayers" ))
     {