Salome HOME
0021514: EDF GEOM: Partition failure. A fix by PKV.
[modules/geom.git] / src / TransformationGUI / TransformationGUI_RotationDlg.cxx
index 7a50853d3bd289a59c848fb6648d683fae9cdcd9..4dd135d4c84f4aeeb789e10a153d6edb18e24996 100644 (file)
@@ -1,29 +1,28 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  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
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : TransformationGUI_RotationDlg.cxx
 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-//
+
 #include "TransformationGUI_RotationDlg.h"
 
 #include <DlgRef.h>
@@ -215,7 +214,7 @@ void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId)
     SelectionIntoArgument();
   }
   else {
-    displayPreview();
+    processPreview();
   }
 }
 
@@ -225,6 +224,7 @@ void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId)
 //=================================================================================
 void TransformationGUI_RotationDlg::ClickOnOk()
 {
+  setIsApplyAndClose( true );
   if (ClickOnApply())
     ClickOnCancel();
 }
@@ -240,13 +240,10 @@ bool TransformationGUI_RotationDlg::ClickOnApply()
 
   initName();
 
-  myObjects.clear();
-  myEditCurrentArgument = GroupPoints->LineEdit1;
-  myEditCurrentArgument->setText("");
-  myGeomGUI->getApp()->selectionMgr()->clearSelected();
-
   // activate selection and connect selection manager
   ConstructorsClicked(getConstructorId());
+  SelectionIntoArgument();
+
   return true;
 }
 
@@ -328,7 +325,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
     }
   }
 
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -401,7 +398,7 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
   send->setDown(true);
 
   // seems we need it only to avoid preview disappearing, caused by selection mode change
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -443,7 +440,7 @@ void TransformationGUI_RotationDlg::TextValueChangedInSpinBox( const QString& s)
 //=================================================================================
 void TransformationGUI_RotationDlg::ValueChangedInSpinBox()
 {
-  displayPreview();
+  processPreview();
 }
 
 //=================================================================================
@@ -496,7 +493,7 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
       if (toCreateCopy) {
         for (int i = 0; i < myObjects.count(); i++) {
           myCurrObject = myObjects[i];
-          anObj = anOper->RotateCopy(myObjects[i].get(), myAxis.get(), GetAngle() * PI180);
+          anObj = anOper->RotateCopy(myObjects[i].get(), myAxis.get(), GetAngle() * M_PI / 180.);
           if (!anObj->_is_nil()) {
             if(!IsPreview()) {
               anObj->SetParameters(aParameters.join(":").toLatin1().constData());
@@ -508,7 +505,7 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
       else {
         for (int i = 0; i < myObjects.count(); i++) {
           myCurrObject = myObjects[i];
-          anObj = anOper->Rotate(myObjects[i].get(), myAxis.get(), GetAngle() * PI180);
+          anObj = anOper->Rotate(myObjects[i].get(), myAxis.get(), GetAngle() * M_PI / 180.);
           if (!anObj->_is_nil()) {
             if(!IsPreview()) {
               anObj->SetParameters(aParameters.join(":").toLatin1().constData());