Salome HOME
IMPs 21044, 21057, 21067
[modules/geom.git] / src / OperationGUI / OperationGUI_ArchimedeDlg.cxx
index 96840b012167322ae45df629ae42abf6055c7010..ac94da8a2a6583c7122899c165dad06597bdff52 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  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
@@ -19,6 +19,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : OperationGUI_ArchimedeDlg.cxx
 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
@@ -106,9 +107,9 @@ void OperationGUI_ArchimedeDlg::Init()
   double SpecificStep1 = 0.1;
   double SpecificStep2 = 0.01;
   /* min, max, myStep and decimals for spin boxes & initial values */
-  initSpinBox( GroupPoints->SpinBox_DX, 0.001, COORD_MAX, myStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
-  initSpinBox( GroupPoints->SpinBox_DY, 0.001, COORD_MAX, SpecificStep1, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
-  initSpinBox( GroupPoints->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep2, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
+  initSpinBox( GroupPoints->SpinBox_DX, 0.001, COORD_MAX, myStep, "weight_precision" );
+  initSpinBox( GroupPoints->SpinBox_DY, 0.001, COORD_MAX, SpecificStep1, "density_precision" );
+  initSpinBox( GroupPoints->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep2, "parametric_precision" );
 
   GroupPoints->SpinBox_DX->setValue( 100.0 );
   GroupPoints->SpinBox_DY->setValue( 1.0 );
@@ -123,7 +124,7 @@ void OperationGUI_ArchimedeDlg::Init()
   connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
   
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
-          this, SLOT( SelectionIntoArgument() ) );
+           this, SLOT( SelectionIntoArgument() ) );
   
   initName( tr( "GEOM_ARCHIMEDE" ) );
   
@@ -141,8 +142,10 @@ void OperationGUI_ArchimedeDlg::Init()
 void OperationGUI_ArchimedeDlg::SetDoubleSpinBoxStep( double step )
 {
   GroupPoints->SpinBox_DX->setSingleStep(step);
-  GroupPoints->SpinBox_DY->setSingleStep(step);
-  GroupPoints->SpinBox_DZ->setSingleStep(step);
+  
+  // san: Commented so as not to override specific step settings
+  //GroupPoints->SpinBox_DY->setSingleStep(step);
+  //GroupPoints->SpinBox_DZ->setSingleStep(step);
 }
 
 //=================================================================================
@@ -185,10 +188,9 @@ void OperationGUI_ArchimedeDlg::SelectionIntoArgument()
   if (aSelList.Extent() != 1)
     return;
 
-  Standard_Boolean testResult = Standard_False;
-  myShape = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
+  myShape = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
 
-  if (!testResult || myShape->_is_nil() || !GEOMBase::IsShape(myShape)) {
+  if ( !GEOMBase::IsShape(myShape) ) {
     myShape = GEOM::GEOM_Object::_nil();
     return;
   }
@@ -220,7 +222,7 @@ void OperationGUI_ArchimedeDlg::ActivateThisDialog()
   GEOMBase_Skeleton::ActivateThisDialog();
   globalSelection( GEOM_ALLSHAPES );
   connect( myGeomGUI->getApp()->selectionMgr(),
-          SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
 }
 
 
@@ -264,14 +266,12 @@ bool OperationGUI_ArchimedeDlg::isValid( QString& msg )
 //=================================================================================
 bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects )
 {
-  GEOM::GEOM_Object_var anObj;
-
   double aWeight         = GroupPoints->SpinBox_DX->value();
   double aWaterDensity   = GroupPoints->SpinBox_DY->value();
   double aMeshDeflection = GroupPoints->SpinBox_DZ->value();
   
-  anObj = GEOM::GEOM_ILocalOperations::_narrow(
-    getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection );
+  GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation());
+  GEOM::GEOM_Object_var anObj = anOper->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection );
 
   if ( !anObj->_is_nil() )
   {
@@ -281,7 +281,7 @@ bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects )
       aParameters << GroupPoints->SpinBox_DX->text();
       aParameters << GroupPoints->SpinBox_DY->text();
       aParameters << GroupPoints->SpinBox_DZ->text();
-      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
     }
     objects.push_back( anObj._retn() );
   }