Salome HOME
Update copyright notes (for 2010)
[modules/geom.git] / src / TransformationGUI / TransformationGUI_TranslationDlg.cxx
index bdbd96a7c9bc2927809958b7cdbb9e64daf79830..73a7694b2c933bd96da7bc64a3f911bf3f44d01a 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   : TransformationGUI_TranslationDlg.cxx
 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
@@ -118,9 +119,9 @@ void TransformationGUI_TranslationDlg::Init()
   double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
 
   // min, max, step and decimals for spin boxes & initial values
-  initSpinBox(GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
-  initSpinBox(GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
-  initSpinBox(GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
+  initSpinBox(GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, "length_precision" );
+  initSpinBox(GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, "length_precision" );
+  initSpinBox(GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, "length_precision" );
 
   GroupPoints->SpinBox1->setValue(0.0);
   GroupPoints->SpinBox2->setValue(0.0);
@@ -396,10 +397,11 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
   }
 
   // clear selection
-  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+  /*  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
   myGeomGUI->getApp()->selectionMgr()->clearSelected();
   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
-          this, SLOT(SelectionIntoArgument()));
+  this, SLOT(SelectionIntoArgument()));*/
+  // here commented, because multiple objects can be selected IPAL 21437
 
   displayPreview();
 }
@@ -480,7 +482,7 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
-          this, SLOT( SelectionIntoArgument() ) );
+           this, SLOT( SelectionIntoArgument() ) );
 
   ConstructorsClicked( getConstructorId() );
 }
@@ -554,6 +556,8 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
 
   GEOM::GEOM_Object_var anObj;
 
+  GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
+
   switch (getConstructorId()) {
   case 0:
     {
@@ -569,11 +573,10 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
       if (toCreateCopy) {
         for (int i = 0; i < myObjects.length(); i++) {
           myCurrObject = myObjects[i];
-          anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
-            TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
+          anObj = anOper->TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
           if (!anObj->_is_nil()) {
             if(!IsPreview())
-              anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+              anObj->SetParameters(aParameters.join(":").toLatin1().constData());
             objects.push_back(anObj._retn());
           }
         }
@@ -581,15 +584,14 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
       else {
         for (int i = 0; i < myObjects.length(); i++) {
           myCurrObject = myObjects[i];
-          anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
-            TranslateDXDYDZ(myObjects[i], dx, dy, dz);
+          anObj = anOper->TranslateDXDYDZ(myObjects[i], dx, dy, dz);
           if (!anObj->_is_nil()) {
             if(!IsPreview()) {
-              anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-             updateAttributes(anObj, aParameters);
-           }
+              anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+              updateAttributes(anObj, aParameters);
+            }
             objects.push_back(anObj._retn());
-         }
+          }
         }
       }
       res = true;
@@ -600,8 +602,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
       if (toCreateCopy) {
         for (int i = 0; i < myObjects.length(); i++) {
           myCurrObject = myObjects[i];
-          anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
-            TranslateTwoPointsCopy(myObjects[i], myPoint1, myPoint2);
+          anObj = anOper->TranslateTwoPointsCopy(myObjects[i], myPoint1, myPoint2);
           if (!anObj->_is_nil())
             objects.push_back(anObj._retn());
         }
@@ -609,8 +610,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
       else {
         for (int i = 0; i < myObjects.length(); i++) {
           myCurrObject = myObjects[i];
-          anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
-            TranslateTwoPoints(myObjects[i], myPoint1, myPoint2);
+          anObj = anOper->TranslateTwoPoints(myObjects[i], myPoint1, myPoint2);
           if (!anObj->_is_nil())
             objects.push_back(anObj._retn());
         }
@@ -627,13 +627,13 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
         double aDistance = GroupPoints->SpinBox3->value();
         for (int i = 0; i < myObjects.length(); i++) {
           myCurrObject = myObjects[i];
-          anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
-            TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
+          anObj = anOper->TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
           if (!anObj->_is_nil()) {
-           if(!IsPreview()) {
-             anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-             updateAttributes(anObj, aParameters);
-           }
+            if(!IsPreview()) {
+              anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+              if (!toCreateCopy)
+                updateAttributes(anObj, aParameters);
+            }
             objects.push_back(anObj._retn());
           }
         }
@@ -642,8 +642,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
         if (toCreateCopy) {
           for (int i = 0; i < myObjects.length(); i++) {
             myCurrObject = myObjects[i];
-            anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
-              TranslateVectorCopy(myObjects[i], myVector);
+            anObj = anOper->TranslateVectorCopy(myObjects[i], myVector);
             if (!anObj->_is_nil())
               objects.push_back(anObj._retn());
           }
@@ -651,8 +650,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
         else {
           for (int i = 0; i < myObjects.length(); i++) {
             myCurrObject = myObjects[i];
-            anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
-              TranslateVector(myObjects[i], myVector);
+            anObj = anOper->TranslateVector(myObjects[i], myVector);
             if (!anObj->_is_nil())
               objects.push_back(anObj._retn());
           }
@@ -681,7 +679,8 @@ void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr   t
     anArgs[0] = myCurrObject;
     getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
                                         /*theFindMethod=*/GEOM::FSM_Transformed,
-                                        /*theInheritFirstArg=*/true);
+                                        /*theInheritFirstArg=*/true,
+                                        mainFrame()->CheckBoxAddPrefix->isChecked());
   }
 }