Salome HOME
IPAL21695 TC5.1.4: GEOM Dialogs Behavior
[modules/geom.git] / src / OperationGUI / OperationGUI_ChamferDlg.cxx
index af89feddd4a931f2eaf9580910c50170708ef756..a10babc449274f88ab2aff1975a299b32adeed64 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
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : OperationGUI_ChamferDlg.cxx
 // Author : Damien COQUERET, Open CASCADE S.A.S.
 //
 #include "OperationGUI_ChamferDlg.h"
-#include <QtxDoubleSpinBox.h>
+#include <SalomeApp_DoubleSpinBox.h>
 
 #include <DlgRef.h>
 #include <GeometryGUI.h>
@@ -149,9 +150,9 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q
   QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIter;
   for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) {
     if (anIter.key() == SpinBox44 || anIter.key() == SpinBox34 || anIter.key() == SpinBox24)
-      initSpinBox(anIter.value(), 0.001, 89.999, 5, 0);
+      initSpinBox(anIter.value(), 0.001, 89.999, 5, "angle_precision" );
     else
-      initSpinBox(anIter.value(), 0.001, COORD_MAX, SpecificStep, 3);
+      initSpinBox(anIter.value(), 0.001, COORD_MAX, SpecificStep, "length_precision" );
   }
 
   setHelpFileName("chamfer_operation_page.html");
@@ -583,7 +584,7 @@ void OperationGUI_ChamferDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
-          this, SLOT( SelectionIntoArgument() ) );
+           this, SLOT( SelectionIntoArgument() ) );
 
   ConstructorsClicked( getConstructorId() );
 }
@@ -751,37 +752,37 @@ bool OperationGUI_ChamferDlg::isValid (QString& msg)
     case 1:
       if (myRadioButton[ RadioButton21 ]->isChecked())
       {
-       ok = mySpinBox[ SpinBox21 ]->isValid( msg, !IsPreview() ) && ok;
-       ok = mySpinBox[ SpinBox22 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox21 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox22 ]->isValid( msg, !IsPreview() ) && ok;
       }
       else
       {
-       ok = mySpinBox[ SpinBox23 ]->isValid( msg, !IsPreview() ) && ok;
-       ok = mySpinBox[ SpinBox24 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox23 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox24 ]->isValid( msg, !IsPreview() ) && ok;
       }
       return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0 && ok;
     case 2:
       if (myRadioButton[ RadioButton31 ]->isChecked())
       {
-       ok = mySpinBox[ SpinBox31 ]->isValid( msg, !IsPreview() ) && ok;
-       ok = mySpinBox[ SpinBox32 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox31 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox32 ]->isValid( msg, !IsPreview() ) && ok;
       }
       else
       {
-       ok = mySpinBox[ SpinBox33 ]->isValid( msg, !IsPreview() ) && ok;
-       ok = mySpinBox[ SpinBox34 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox33 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox34 ]->isValid( msg, !IsPreview() ) && ok;
       }
       return !myShape->_is_nil() && myFaces.Extent() > 0 && ok;
     case 3:
       if (myRadioButton[ RadioButton41 ]->isChecked())
       {
-       ok = mySpinBox[ SpinBox41 ]->isValid( msg, !IsPreview() ) && ok;
-       ok = mySpinBox[ SpinBox42 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox41 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox42 ]->isValid( msg, !IsPreview() ) && ok;
       }
       else
       {
-       ok = mySpinBox[ SpinBox43 ]->isValid( msg, !IsPreview() ) && ok;
-       ok = mySpinBox[ SpinBox44 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox43 ]->isValid( msg, !IsPreview() ) && ok;
+        ok = mySpinBox[ SpinBox44 ]->isValid( msg, !IsPreview() ) && ok;
       }
       return !myShape->_is_nil() && myEdges.Extent() > 0 && ok;
     default: return false;
@@ -801,37 +802,37 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
                myRadioButton[ RadioButton41 ]->isChecked());
 
   int anId = getConstructorId();
+
+  GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation());
+
   if (anId == 0) {
-    anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
-      MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value());
+    anObj = anOper->MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value());
     if (!anObj->_is_nil())
       aParameters << mySpinBox[ SpinBox1 ]->text();
   }
   else if (anId == 1) {
     if (flag) {
-      anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
-        MakeChamferEdge(myShape,
-                        mySpinBox[ SpinBox21 ]->value(),
-                        mySpinBox[ SpinBox22 ]->value(),
-                        myFace[ Face1 ],
-                        myFace[ Face2 ]);
+      anObj = anOper->MakeChamferEdge(myShape,
+                                      mySpinBox[ SpinBox21 ]->value(),
+                                      mySpinBox[ SpinBox22 ]->value(),
+                                      myFace[ Face1 ],
+                                      myFace[ Face2 ]);
       if (!anObj->_is_nil())
       {
-       aParameters << mySpinBox[ SpinBox21 ]->text();
-       aParameters << mySpinBox[ SpinBox22 ]->text();
+        aParameters << mySpinBox[ SpinBox21 ]->text();
+        aParameters << mySpinBox[ SpinBox22 ]->text();
       }
     }
     else {
-      anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
-        MakeChamferEdgeAD(myShape,
-                          mySpinBox[ SpinBox23 ]->value(),
-                          mySpinBox[ SpinBox24 ]->value() * PI180,
-                          myFace[ Face1 ],
-                          myFace[ Face2 ]);
+      anObj = anOper->MakeChamferEdgeAD(myShape,
+                                        mySpinBox[ SpinBox23 ]->value(),
+                                        mySpinBox[ SpinBox24 ]->value() * PI180,
+                                        myFace[ Face1 ],
+                                        myFace[ Face2 ]);
       if (!anObj->_is_nil())
       {
-       aParameters << mySpinBox[ SpinBox23 ]->text();
-       aParameters << mySpinBox[ SpinBox24 ]->text();
+        aParameters << mySpinBox[ SpinBox23 ]->text();
+        aParameters << mySpinBox[ SpinBox24 ]->text();
       }
     }
   }
@@ -844,27 +845,25 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
       anArray[ i - 1 ] = myFaces(i);
 
     if (flag) {
-      anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
-       MakeChamferFaces(myShape,
-                        mySpinBox[ SpinBox31 ]->value(),
-                        mySpinBox[ SpinBox32 ]->value(),
-                        anArray);
+      anObj = anOper->MakeChamferFaces(myShape,
+                                       mySpinBox[ SpinBox31 ]->value(),
+                                       mySpinBox[ SpinBox32 ]->value(),
+                                       anArray);
       if (!anObj->_is_nil())
       {
-       aParameters << mySpinBox[ SpinBox31 ]->text();
-       aParameters << mySpinBox[ SpinBox32 ]->text();
+        aParameters << mySpinBox[ SpinBox31 ]->text();
+        aParameters << mySpinBox[ SpinBox32 ]->text();
       }
     }
     else {
-      anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
-       MakeChamferFacesAD(myShape,
-                          mySpinBox[ SpinBox33 ]->value(),
-                          mySpinBox[ SpinBox34 ]->value() * PI180,
-                          anArray);
+      anObj = anOper->MakeChamferFacesAD(myShape,
+                                         mySpinBox[ SpinBox33 ]->value(),
+                                         mySpinBox[ SpinBox34 ]->value() * PI180,
+                                         anArray);
       if (!anObj->_is_nil())
       {
-       aParameters << mySpinBox[ SpinBox33 ]->text();
-       aParameters << mySpinBox[ SpinBox34 ]->text();
+        aParameters << mySpinBox[ SpinBox33 ]->text();
+        aParameters << mySpinBox[ SpinBox34 ]->text();
       }
     }
   }
@@ -874,27 +873,25 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
     for (int i = 1, n = myEdges.Extent(); i <= n; i++)
       anArray[ i - 1 ] = myEdges(i);
     if (flag) {
-      anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
-        MakeChamferEdges(myShape,
-                         mySpinBox[ SpinBox41 ]->value(),
-                         mySpinBox[ SpinBox42 ]->value(),
-                         anArray);
+      anObj = anOper->MakeChamferEdges(myShape,
+                                       mySpinBox[ SpinBox41 ]->value(),
+                                       mySpinBox[ SpinBox42 ]->value(),
+                                       anArray);
       if (!anObj->_is_nil())
       {
-       aParameters << mySpinBox[ SpinBox41 ]->text();
-       aParameters << mySpinBox[ SpinBox42 ]->text();
+        aParameters << mySpinBox[ SpinBox41 ]->text();
+        aParameters << mySpinBox[ SpinBox42 ]->text();
       }
     }
     else {
-      anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
-        MakeChamferEdgesAD(myShape,
-                           mySpinBox[ SpinBox43 ]->value(),
-                           mySpinBox[ SpinBox44 ]->value() * PI180,
-                           anArray);
+      anObj = anOper->MakeChamferEdgesAD(myShape,
+                                         mySpinBox[ SpinBox43 ]->value(),
+                                         mySpinBox[ SpinBox44 ]->value() * PI180,
+                                         anArray);
       if (!anObj->_is_nil())
       {
-       aParameters << mySpinBox[ SpinBox43 ]->text();
-       aParameters << mySpinBox[ SpinBox44 ]->text();
+        aParameters << mySpinBox[ SpinBox43 ]->text();
+        aParameters << mySpinBox[ SpinBox44 ]->text();
       }
     }
   }
@@ -902,7 +899,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
   if (!anObj->_is_nil())
   {
     if (!IsPreview())
-      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
     objects.push_back(anObj._retn());
   }