]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx
Salome HOME
old notebook functionality is temporary commented
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ExtrusionDlg.cxx
index 2ed9123835b509ec3bde2c6d902449c572bd2f66..d37a1ca89d3c82b3df562762a086053010e8e215 100644 (file)
@@ -88,6 +88,7 @@
 //=================================================================================
 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
   : QDialog( SMESH::GetDesktop( theModule ) ),
+    SMESHGUI_Helper( theModule ),
     mySMESHGUI( theModule ),
     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
     myFilterDlg( 0 ),
@@ -400,24 +401,24 @@ void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
     {
       GroupArguments->setTitle(tr("EXTRUSION_1D"));
       if (!CheckBoxMesh->isChecked())
-       {
-         LineEditElements->clear();
-         myIDs.clear();
-         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-           aViewWindow->SetSelectionMode(EdgeSelection);
-       }
+        {
+          LineEditElements->clear();
+          myIDs.clear();
+          if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+            aViewWindow->SetSelectionMode(EdgeSelection);
+        }
       break;
     }
   case 1:
     {
       GroupArguments->setTitle(tr("EXTRUSION_2D"));
       if (!CheckBoxMesh->isChecked())
-       {
-         LineEditElements->clear();
-         myIDs.clear();
-         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-           aViewWindow->SetSelectionMode(FaceSelection);
-       }
+        {
+          LineEditElements->clear();
+          myIDs.clear();
+          if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+            aViewWindow->SetSelectionMode(FaceSelection);
+        }
       break;
     }
   }
@@ -509,8 +510,8 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
       aParameters << SpinBox_Dz->text();
     } else if ( RadioButton4->isChecked() ) {
       gp_XYZ aNormale(SpinBox_Vx->GetValue(),
-                     SpinBox_Vy->GetValue(),
-                     SpinBox_Vz->GetValue());
+                      SpinBox_Vy->GetValue(),
+                      SpinBox_Vz->GetValue());
     
      
       aNormale /= aNormale.Modulus();
@@ -536,29 +537,29 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
 
       if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
         if( CheckBoxMesh->isChecked() ) {
-         if( GetConstructorId() == 0 )
-           SMESH::ListOfGroups_var groups = 
-             aMeshEditor->ExtrusionSweepObject1DMakeGroups(mySelectedObject, aVector, aNbSteps);
-         else
-           SMESH::ListOfGroups_var groups = 
-             aMeshEditor->ExtrusionSweepObject2DMakeGroups(mySelectedObject, aVector, aNbSteps);
-       }
-       else
-         SMESH::ListOfGroups_var groups = 
-           aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
+          if( GetConstructorId() == 0 )
+            SMESH::ListOfGroups_var groups = 
+              aMeshEditor->ExtrusionSweepObject1DMakeGroups(mySelectedObject, aVector, aNbSteps);
+          else
+            SMESH::ListOfGroups_var groups = 
+              aMeshEditor->ExtrusionSweepObject2DMakeGroups(mySelectedObject, aVector, aNbSteps);
+        }
+        else
+          SMESH::ListOfGroups_var groups = 
+            aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
       }
       else {
-       if( CheckBoxMesh->isChecked() ) {
-         if( GetConstructorId() == 0 )
-           aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
-         else
-           aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
-       }
-       else
-         aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
+        if( CheckBoxMesh->isChecked() ) {
+          if( GetConstructorId() == 0 )
+            aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
+          else
+            aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
+        }
+        else
+          aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
       }
 
-      myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
+      //asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
 
     } catch (...) {
     }
@@ -611,10 +612,10 @@ void SMESHGUI_ExtrusionDlg::ClickOnHelp()
     platform = "application";
 #endif
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
-                            tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                            arg(app->resourceMgr()->stringValue("ExternalBrowser", 
-                                                                platform)).
-                            arg(myHelpFileName));
+                             tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", 
+                                                                 platform)).
+                             arg(myHelpFileName));
   }
 }
 
@@ -666,7 +667,7 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
       myElementsId->length( myNbOkElements = newIndices.Extent() );
       mySelector->AddOrRemoveIndex(myIO, newIndices, false);
       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-       aViewWindow->highlight( myIO, true, true );
+        aViewWindow->highlight( myIO, true, true );
     }
   }
 
@@ -744,7 +745,7 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
       aNbElements = aMapIndex.Extent();
 
       if (aNbElements < 1)
-       return;
+        return;
 
       myElementsId = new SMESH::long_array;
       myElementsId->length( aNbElements );
@@ -802,20 +803,20 @@ void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
     myEditCurrentArgument = (QWidget*)LineEditElements;
     if (CheckBoxMesh->isChecked()) {
       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-       aViewWindow->SetSelectionMode(ActorSelection);
+        aViewWindow->SetSelectionMode(ActorSelection);
       mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
     } else {
       int aConstructorId = GetConstructorId();
       if (aConstructorId == 0)
-       {
-         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-           aViewWindow->SetSelectionMode(EdgeSelection);
-       }
+        {
+          if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+            aViewWindow->SetSelectionMode(EdgeSelection);
+        }
       else if (aConstructorId == 1)
-       {
-         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-           aViewWindow->SetSelectionMode(FaceSelection);
-       }
+        {
+          if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+            aViewWindow->SetSelectionMode(FaceSelection);
+        }
     }
   }
   else if (send == SelectVectorButton){
@@ -930,13 +931,13 @@ void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
     int aConstructorId = GetConstructorId();
     if (aConstructorId == 0)
       {
-       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-         aViewWindow->SetSelectionMode(EdgeSelection);
+        if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+          aViewWindow->SetSelectionMode(EdgeSelection);
       }
     else if (aConstructorId == 1)
       {
-       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-         aViewWindow->SetSelectionMode(FaceSelection);
+        if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+          aViewWindow->SetSelectionMode(FaceSelection);
       }
 
     LineEditElements->setReadOnly(false);
@@ -983,8 +984,8 @@ void SMESHGUI_ExtrusionDlg::setFilters()
 {
   if(myMesh->_is_nil()) {
     SUIT_MessageBox::critical(this,
-                             tr("SMESH_ERROR"),
-                             tr("NO_MESH_SELECTED"));
+                              tr("SMESH_ERROR"),
+                              tr("NO_MESH_SELECTED"));
    return;
   }
   if ( !myFilterDlg )
@@ -1009,26 +1010,11 @@ void SMESHGUI_ExtrusionDlg::setFilters()
 //=================================================================================
 bool SMESHGUI_ExtrusionDlg::isValid()
 {
-  QString msg;
-  bool ok = true;
-  if ( RadioButton3->isChecked() ) {
-    ok = SpinBox_Dx->isValid( msg, true ) && ok;
-    ok = SpinBox_Dy->isValid( msg, true ) && ok;
-    ok = SpinBox_Dz->isValid( msg, true ) && ok;
-  } else if ( RadioButton4->isChecked() ) {
-    ok = SpinBox_Vx->isValid( msg, true ) && ok;
-    ok = SpinBox_Vy->isValid( msg, true ) && ok;
-    ok = SpinBox_Vz->isValid( msg, true ) && ok;
-    ok = SpinBox_VDist->isValid( msg, true ) && ok;
-  }
-  ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
-
-  if( !ok ) {
-    QString str( tr( "SMESH_INCORRECT_INPUT" ) );
-    if ( !msg.isEmpty() )
-      str += "\n" + msg;
-    SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
-    return false;
-  }
-  return true;
+  QList<QAbstractSpinBox*> aSpinBoxList;
+  if ( RadioButton3->isChecked() )
+    aSpinBoxList << SpinBox_Dx << SpinBox_Dy << SpinBox_Dz;
+  else if ( RadioButton4->isChecked() )
+    aSpinBoxList << SpinBox_Vx << SpinBox_Vy << SpinBox_Vz;
+  aSpinBoxList << SpinBox_NbSteps;
+  return checkParameters( true, aSpinBoxList );
 }